! gltemplate.inf - GLoader template and demo/gallery ! (c) 2006 by L. Ross Raszewski but freely usable ! ! This program serves two functions. The first part of the file ! contains a skeleton template that sets up GWindows and the GLoader. ! You may use this as a starting point for writing your own game which ! uses GLoader, changing the opening constant definitions and ! the block labled "Add GLoader UIs here" ! ! The second part of the file, begining in the middle of Initialise(), ! contains code allowing this file to be used as a demonstration program ! and UI Gallery. When compiled, this program shows a simple husk of a game ! from which the player may switch to any included UI, and demonstrate ! features such as menus and image display. ! Included in the code is an example of how to allow the player to choose ! a UI at runtime. Constant STORY "GLoader Template"; Constant HEADLINE "^By L. Ross Raszewski. (c) 2006"; Constant GW_ECHO_OVERRIDE; ! Include Gwindows Definitions include "gwindefs"; include "parser"; include "verblib"; ! Include GWindows base classes include "gwincls"; ! Include GWindows hooks include "gwindows"; include "grammar"; ! Include GLoader include "gloader"; ! Resource definitions include "gltemplate.bli"; ! Add GLoader UIs here include "LookSharp"; include "Legendary"; include "Balanced"; include "Momentus"; include "Hugonaut"; include "Poppy"; include "Context"; include "Barry"; include "Westward"; ! Initialization code [ InitGWindows; if (Active_UI==0) GW_LoadUI(UI_Classic); ]; [ Initialise; if (Active_UI provides before) Active_UI.before(); ! Replace all code below this with your own location=testrm; "This is the GLoader Template and UI Test Program."; ]; object testrm "Test Room" with description "This is a test room. You can play around with the UI by using the command ~MODE~. To play further, type ~MENU~ to show a menu, or ~PICTURE~ to show a picture. You can also pick up and drop the thing if you like.", has light; object -> "thing" with name 'thing'; object test_menu; object -> "One" with select [; "One!"; ]; object -> "Two" with select [; "Two!"; ]; object -> "Close Menu" with select [; GW_EndModalMenu(); ]; [ MenuModeSub; GW_ShowModalMenu(Test_Menu); ]; verb 'menu' * -> MenuMode; [ PictureModeSub; GW_ShowImage(LEGENDARY_COMPAS_PIC); ]; verb 'picture' * -> PictureMode; global myparsed_word; [ ModeErrorSub o; print "To change to a mode, type ~MODE X~ where X is one of the following installed UIs:^"; objectloop(o ofclass GWin_UI) { if (o provides name) print " ", (address) o.&name-->0, "^"; } ]; [ ModeSetSub o; objectloop(o ofclass GWin_UI) { if (o provides name && o.&name-->0==myparsed_word) { GW_ChangeUI(o); return; } } ModeErrorSub(); ]; [ ModeGPR x; x=NextWord(); if (~~x) return GPR_FAIL; myparsed_word=x; return GPR_PREPOSITION; ]; verb 'mode' * -> ModeError * ModeGPR -> ModeSet;