Glimmr, a set of extensions for use with Inform 7 and the subject of this occasional blog, has finally been released. For the uninitiated, Inform is software for writing interactive fiction, otherwise known as “text adventures,” using English-like sentences. Inform can compile to the Glulx virtual machine, which allows for graphics, sound, and other features. But Inform’s native support for these features is quite meager, and Glimmr is an attempt to bring Inform’s support for graphics up to the level of Glulx’s potential.
Glimmr is a modular system of extensions. Several of these extensions can be used independently of other Glimmr modules, but they gain additional capabilities when used in conjunction. The bedrock extension, Glimmr Drawing Commands, provides basic instructions to draw a wide variety of entities, from simple rectangles, to external images files (PNG or JPEG), to bitmaps and even painted text. Here are some representative drawing commands:
Other extensions are what we might call “data” extensions, which don’t themselves provide new functionality. Fonts and tilesets are distributed in this way. Examples include Glimmr Bitmap Font and Glimmr Image Font.
But the core of Glimmr is the Canvas-Based Drawing extension. This module supplies a complete screen model for graphics windows, using the notion of the “canvas”. Graphic elements–anything that can be drawn using Glimmr Drawing Commands, or any new command the user wishes to invent–are assigned to a canvas. The canvas can then be shown in a graphics window. The scaling and the framing of the canvas within the window can be controlled, and canvases can be swapped out at will. It is easy to specify the layering of elements on the canvas, so that in effect graphics can be displayed along three axes (x, y, and z). Canvas-Based Drawing allows for complex and dynamic compositions to be created relatively quickly. The Glimmr Graphic Hyperlinks extension automates the handling of mouse input to any element.
Glimmr ships with another extension, built on Canvas-Based Drawing, called the Glimmr Canvas Editor. The Canvas Editor is meant to be compiled as an independent project, not as a part of another game, and it produces a complete GUI graphics editor that can be used to draw elements of various types to a canvas, visually. Once the canvas is complete, you can export it as Inform source code for use with Canvas-Based Drawing. Special features are included to deal with canvases that change over time, such as maps that dynamically reveal themselves as the player discovers new locations in the game.