#Endif; ! TARGET_GLULX #Ifdef TARGET_GLULX; [ GGInitialise res; @gestalt 4 2 res; ! Test if this interpreter has Glk. if (res == 0) { ! Without Glk, we're entirely screwed. quit; } ! Set the VM's I/O system to be Glk. @setiosys 2 0; ! First, we must go through all the Glk objects that exist, and see ! if we created any of them. One might think this strange, since the ! program has just started running, but remember that the player might ! have just typed "restart". GGRecoverObjects(); res = InitGlkWindow(0); if (res ~= 0) return; ! Now, gg_mainwin and gg_storywin might already be set. If not, set them. if (gg_mainwin == 0) { ! Open the story window. res = InitGlkWindow(GG_MAINWIN_ROCK); if (res == 0) gg_mainwin = glk($0023, 0, 0, 0, 3, GG_MAINWIN_ROCK); ! window_open if (gg_mainwin == 0) { ! If we can't even open one window, there's no point in going on. quit; } } else { ! There was already a story window. We should erase it. glk($002A, gg_mainwin); ! window_clear } if (gg_statuswin == 0) { res = InitGlkWindow(GG_STATUSWIN_ROCK); if (res == 0) { gg_statuswin_cursize = gg_statuswin_size; gg_statuswin = glk($0023, gg_mainwin, $12, gg_statuswin_cursize, 4, GG_STATUSWIN_ROCK); ! window_open } } ! It's possible that the status window couldn't be opened, in which case ! gg_statuswin is now zero. We must allow for that later on. glk($002F, gg_mainwin); ! set_window InitGlkWindow(1); ];