Top |
char * | garglk_fileref_get_name () |
void | garglk_set_program_name () |
void | garglk_set_program_info () |
void | garglk_set_story_name () |
void | garglk_set_story_title () |
void | garglk_unput_string () |
void | garglk_unput_string_uni () |
void | garglk_set_zcolors () |
void | garglk_set_zcolors_stream () |
void | garglk_set_reversevideo () |
void | garglk_set_reversevideo_stream () |
#define | GARGLK |
#define | zcolor_Current |
#define | zcolor_Default |
#define | zcolor_Cursor |
#define | zcolor_Transparent |
#define | keycode_Erase |
#define | keycode_MouseWheelUp |
#define | keycode_MouseWheelDown |
This section describes various extensions to Glk that were written for the popular interpreter Gargoyle by Tor Andersson (now maintained by Ben Cressey).
These functions mostly serve to close the gap between Glk's input/output
capabilities and what some interpreters expect. For example,
garglk_set_zcolors()
displays the colors defined in the Z-machine standard,
and garglk_set_story_name()
can be used to give the host program a hint
about what to display in the title bar of its window.
char *
garglk_fileref_get_name (frefid_t fref
);
Gets the actual disk filename that fref
refers to, in the platform's
native filename encoding. The string is owned by fref
and must not be
changed or freed.
void
garglk_set_program_name (const char *name
);
This function is used to let the library know the name of the currently running Glk program, in case it wants to display this information somewhere — for example, in the title bar of a window. A typical use of this function would be:
1 |
garglk_set_program_name("SuperGlkFrotz 0.1"); |
void
garglk_set_program_info (const char *info
);
This function is used to provide the library with additional information about the currently running Glk program, in case it wants to display this information somewhere — for example, in an About box. A typical use of this function would be:
1 2 3 4 5 |
garglk_set_program_info("SuperGlkFrotz, version 0.1\n" "Original Frotz by Stefan Jokisch\n" "Unix port by Jim Dunleavy and David Griffith\n" "Glk port by Tor Andersson\n" "Animation, networking, and evil AI by Sven Metcalfe"); |
void
garglk_set_story_name (const char *name
);
If the Glk program running is an interactive fiction interpreter, then this function can be used to let the library know the name of the story currently loaded in the interpreter, in case it wants to display this information anywhere — for example, in the title bar of a window. A typical use of this function would be:
1 |
garglk_set_story_name("Lighan Ses Lion, el Zarf"); |
void
garglk_set_story_title (const char *title
);
This function is a hint to the library to put title
in the title bar of the
window that the Glk program is running in. It overrides
garglk_set_program_name()
and garglk_set_story_name()
, if they were displayed
in the title bar, although they may still be displayed somewhere else.
This function is not currently implemented.
void
garglk_unput_string (char *str
);
Removes str
from the end of the current stream, if indeed it is there. The
stream's write count is decreased accordingly, and the stream's echo stream
is also modified, if it has one.
This function is not currently implemented.
void
garglk_unput_string_uni (glui32 *str
);
Like garglk_unput_string()
, but for Unicode streams.
This function is not currently implemented.
void garglk_set_zcolors (glui32 fg
,glui32 bg
);
Glk works with styles, not specific colors. This is not quite compatible with the Z-machine, so this Glk extension implements Z-machine style colors.
This function changes the foreground color of the current stream to fg
and
the background color to bg
. fg
and bg
are encoded the same way as
described in stylehint_TextColor
.
void garglk_set_zcolors_stream (strid_t str
,glui32 fg
,glui32 bg
);
This function changes the foreground color of str
to fg
and the background
color to bg
. fg
and bg
are encoded the same way as described in
stylehint_TextColor
. See garglk_set_zcolors()
for more information.
void
garglk_set_reversevideo (glui32 reverse
);
If reverse
is not zero, uses the foreground color of the current stream as
its background and vice versa. If reverse
is zero, changes the colors of the
current stream back to normal.
#define GARGLK 1
To test at compile time whether the Gargoyle extensions are available, you
can perform a preprocessor test for the existence of GARGLK
. If this
macro is defined, then so are all the Gargoyle extensions. If not, not.
Chimara
Currently, in Chimara, the functions are defined, but a few of them (
garglk_unput_string()
andgarglk_unput_string_uni()
) are not implemented. You can call them, but they will have no effect except to print a warning to the console.
#define zcolor_Cursor (-3)
Z-machine color constant representing the color at the current position of the cursor.
Passing this constant to garglk_set_zcolors()
or
garglk_set_zcolors_stream()
is not currently implemented.
#define zcolor_Transparent (-4)
Z-machine color constant representing no color, i.e. transparency.
Passing this constant to garglk_set_zcolors()
or
garglk_set_zcolors_stream()
is not currently implemented.
#define keycode_Erase (0xffffef7f)
Since keycode_Delete
represents either the Delete
or Backspace key, Gargoyle defines a separate constant
keycode_Erase
to represent only
the Delete key.
In character input, Delete is still reported as
keycode_Delete
, but the two are distinguished in
glk_set_terminators_line_event()
.
#define keycode_MouseWheelUp (0xffffeffe)
This key code represents the mouse wheel scrolling up in a window. It is never used in Chimara.