12. GLoader
GLoader is a feature of GWindows to help users get started quickly, and share
their developed UIs with the community. You do not need to use GLoader, but
it may simplify your development process. A collection of GLoader UIs can be found
at http://gwindows.trenchcoatsoft.com
12.1 Using GLoader
The easiest way to use GLoader is to download the GLoader Template/Gallery
source code from http://gwindows.trenchcoatsoft.com
and use it as a skeleton for your game. Alternatively, read documentation
in gloader.h for more detailed usage instructions
12.2 GLoader UIs
A GLoader UI Consists of the following pieces:
- A UI definition (.h) file (required)
- A Blorb Resource definition (.res) file (optional)
- A directory of blorb resources (optional)
The .h file, which should be included in your source code, will provide a UI you
can use like any other. It is preferable to use the GLoader API to load the
interface rather than the techniques explained earlier in this manual. You may
attach as many UIs to a game as you like. The gltemplate program shows a method
for switching between UIs at the user's request.
12.2.1 GLoader Skins
UIs which make use of graphics may offer more than one graphics set (or "skin").
To use a skin other than the default, simply include the resource definition file
for the skin in your blorb resources.
Due to a technical limitation, it is not currently possible to include two skins
for the same UI in a single game without doing significant work by hand.
12.2.2 Customizing UIs
The easiest way to customize a UI is by writing a new skin for it. To do this,
simply duplicate the skin's resource definitions, replacing the graphics with your own.
You can also alter the UI's source using the techniques given in the rest of this manual.
Some UIs may provide additional simple customizations and features. Check their
documentation for details.
12.3 GLoader API features
Gloader provides some additional functionality to make it easier for you to
write code that will operate with a choice of UIs. gloader.h contains more detailed
information on these features. Among GLoader's functionalities are:
- GW_LoadUI(ui): Set the specified UI as the current interface. This should be used
to set the initial screen UI. To change UIs at runtime, use
GW_ChangeUI instead
- GW_ChangeUI(ui)
Change the screen layout to the specifed UI. Similar to GW_LoadUI,
But also forces a restart of the window system and performs
initialization steps. Returns the new UI
- GW_ShowImage(image)
Shows the specified image. If the current UI specifies a graphics
window, the image will be shown there according to the usual
settings (That is, scaled to fit the window, obeying the windows's
aspect ratio settings). If no graphics window is specifed,
the image is displayed at its natural size in the
main window. Returns false if the image could not be displayed
(because the interpreter does not support graphics)
- GW_ShowMenu(menu)
If the current UI specifies a menu window, shows the specifed menu
in it. Returns false and does nothing if the current UI does not
provide a window for menus. If your menu is for game-critical events
(as opposed to a simple alternative to typing), use GW_ShowModalMenu
instead.
- GW_EndMenu()
Deactivates the menu currently displayed in the menu window
- GW_ShowModalMenu(menu)
Shows a modal menu. If the current UI provides a menu window,
the menu will be shown there within a modal context (that is,
normal input will be disallowed while the menu is active).
If the current UI does not provide a menu window, the menu will be
displayed in-line using a simplified menu interface.
- GW_EndModalMenu()
Deactivates the current modal menu. Note that this function
behaves slightly differently when a simplified text menu is used:
When used with a text menu, the menu will terminate after
the current .select() routine returns. When using
a menu window, this function does not return, but terminates
the menu immediately. For best compatability, you should
return immediately after using this function.