This library is a simple and small glulxe wrapper, created for a novice inform programming level. With this library it’s possible to visualize an image or simply to play a sound (or a music) by using a small set of functions that wrap the glulx functions.
There are also text styles ready to be used.
It’s possible to convert a z-code adventure to a glulx adventure with multimedia support, in few steps.
You can use 3 audio channels:
- music : for the music channel
- chan1 : channel 1 for audio (sound effects)
- chan2 : channel 2 for audio (sound effects)
- simple and clean
- it’s possible to convert any zcode (inform6) adventure to a glulx adventure
- Alessandro Schillaci
- Paolo Lucchesi
- Vincenzo Scarpa
- Paolo Maroncelli
This is an open source project (GNU GPL License).
Just follow these points:
include "sgw.h";
just after the Include “parser”; directive
Constants before you include the “sgw.h” library (to override the default setting):
SGWHEIGHT Image window height, in pixels
SCBACK Background color
SCTEXT Main text color
SCSOFT Soft text color
SCEMPH Emphatized text color
SCHEAD Headers color
SCINPU Input line color
(you can use the $rrggbb format for specify hexadecimal rgb color codes)
For example:
Constant SGWHEIGHT 250;
sets the image window height to 250 pixels, while
Constant SCBACK $440044;
sets the background to a dark violet
define one of these constants
Constant NOGRAPHICS;
Constant NOSOUND;
Before you Include the sgw.h library
with description [;
print "Text Style ", (s_emph) "Emphasized", "^";
print "Text Style ", (s_bold) "Bold", " (like Inform)^";
print "Text Style ", (s_pref) "Preformatted", "^";
print "Text Style ", (s_fixed) "Fixed", " (like Inform)^";
print "Text Style ", (s_head) "Header", "^";
print "Text Style ", (s_subhead) "Subheader", "^";
print "Text Style ", (s_alert) "Alert", "^";
print "Text Style ", (s_reverse) "Reverse", " (like Inform)^";
print "Text Style ", (s_note) "Note", "^";
print "Text Style ", (s_underline) "Underline/Italic", " (like Inform)^";
print "Text Style ", (s_block) "BlockQuote", "^";
print "Text Style ", (s_input) "Input", "^";
]
These are also valid in z-code
(you can still use the classic “style bold”, “style roman”, etc. inform directives)
clearMainWindow() = clears the main window
closeAllWindows() = closes all graphic windows
initializeSGW(h) = graphic window dimension is set to h=height
viewImageLeft(image) = shows the “image” in the graphic window on the Left
viewImageCenter(image, image_width) = shows the “image” in the graphic window (Centered)
viewImageRight(image, image_width) = shows the “image” in the graphic window on the Right
playSound(channel,sound,length,volume) = plays a sound/music
setplayMusic(sound,length,volume) = enque a music to be played (not working)
fadeoutMusic() = fades out current music
fadetoMusic(sound,length,volume) = fades in current music
silenceAll() = silences all audio channels
silenceChannel(channel) = silences the audio “channel”
setVolume(val, channel) = set “val” for volume of the channel
length is the no. of times that the sound/music will be played (-1 to play continuously)
SGW automatically handles the HandleGlkEvent, InitGlkWindow and IdentifyGlkObject entry points. If you need to define your own version of one or more of these
entry points, you can define one or more of the following constants:
CUSTOM_HANDLEGLKEVENT
CUSTOM_INITGLKWINDOW
CUSTOM_IDENTIFYGLKOBJECT
before including sgw.h
In your entry points, you can invoke the appropriate the SGW related functions
calling the following routines:
SGWHandleGlkEvent(event)
SGWInitGlkWindow(winrock)
SGWIdentifyGlkObject(phase,type,ref,rock)
Finally, from your InitGlkWindow entry point, you can call the
SGWDefineWindowColors()
routine to set the defined colors for every other window