Glimmr Drawing Commands
version 2/101030 by Erik Temple
Documentation
- Chapter: Including Glimmr Drawing Commands in a project
- Chapter: Preliminary notes about commands
- Chapter: Basic Commands ("Primitives")
- Section: Rectangle
- Section: Dimensioned rectangle
- Section: Image
- Section: Dimensioned image
- Section: Box
- Section: Stroked rectangle
- Section: Line
- Section: Line using distance + angle
- Chapter: Complex commands: Bitmaps
- Chapter: Complex commands: Image-maps
- Chapter: Complex commands: Rendered strings
- Chapter: Tilesets
- Chapter: Fonts and Font Creation
- Section: Creating new fonts
- Section: Steps for the creation of new bitmap fonts
- Section: Extending bitmap fonts
- Section: Creating new image fonts
- Chapter: Debugging
- Section: Echoing the debugging log to the transcript
- Section: Console log comments
- Section: Additional phrases for triggering debugging from source text
- Section: A note for expert users
- Chapter: Contact info
- Chapter: Change Log
- Example: * Retro Drawing - This example presents a good cross-section of the graphics commands provided by GDC. Note that none of the drawing here uses image files--everything is done with "primitives", painted text, and bitmaps.
Glimmr Drawing Commands (GDC) is the most basic of the Glimmr extensions, and is required by (nearly) all others. It exposes the three basic Glulx drawing commands at the I7 level, enabling authors to write their own drawing rules without using any I6 code. Glimmr Drawing Commands also adds a number of "derived" commands--commands that use the basic commands to do new things. These include everything from drawing a line to connect any two points on the screen, to "painting" text to the screen, to drawing a grid of images.
Glimmr Drawing Commands requires Jon Ingold's Flexible Windows as well as Michael Callaghan's Fixed Point Maths. For those familiar with I6, the three infglk functions that GDC implements are glk_image_draw, glk_image_draw_scaled, and glk_window_fill_rect. It does not implement the glk_window_erase_rect command, since this is easily imitated by drawing a rectangle in the background color of the window (Flexible Windows's "back-colour" g-window property).
A note on what GDC will *not* do: It does not:
1) Provide any window-drawing rule structure. Users will need to write their own window-drawing rules from scratch.
2) Scale drawing instructions down (or up) to fit in the window.
3) Ensure that drawing instructions are properly ordered so as to "rebuild" the window whenever needed. (Because a Glulx window can be resized at any time by the player, the window-drawing rules for that window need to completely encapsulate the state of the window.)
For these reasons, GDC should be considered a low-level extension, mostly to be used by experts. Users wanting a robust solution that *does* handle all of the above points should use Glimmr Canvas-Based Drawing.
Note that all graphics operations will be slower within the Inform IDE than in a standalone interpreter. Test your games outside the IDE to get a sense of their actual performance "in the wild". (The Extended Debugging extension will allow you to do this while also retaining debugging commands.)