[code]Include Glulx Entry Points by Emily Short. Use direct event handling.
Figure of a Red Button is the file “red_button.png”.
Part - Displaying Thumbnails
To say thumb (F - a figure-name):
display F as a thumbnail.
To display (chosen figure - a figure-name) as a thumbnail:
(- DrawThumb({chosen figure}); -)
Include (-
[ DrawThumb N;
glk_request_hyperlink_event(gg_mainwin);
glk_set_hyperlink(67);
glk_image_draw(gg_mainwin, ResourceIDsOfFigures–>N, imagealign_MarginLeft, 0);
glk_set_hyperlink(0);
];
-).
Test Chamber is a room. “[thumb Figure of a Red Button]Not much here, other than the big, bright, shiny red button.”
A man called Gordon is here. The indefinite article is “your faithful assistant”.
Include (-
Constant GG_ILLUSTRATION_ROCK 210;
Global gg_full_illustration = 0;
-).
The thumbnail-clicking rule translates into I6 as “THUMBNAIL_R”.
Glulx input handling rule for a hyperlink-event:
open the damn window.
To open the damn window:
(- if gg_full_illustration == 0) {
gg_full_illustration = glk_window_open(gg_mainwin, (winmethod_Above+winmethod_Fixed), 600, wintype_Graphics, GG_ILLUSTRATION_ROCK );
}
-).
[/code]
Here’s what I want to happen: A small graphic (in this example, a red button) appears in the main output window. When the player clicks it, a new graphics window splits from the main window. I have the hyperlink working, but I cannot figure out a way to attach code to the hyperlink event.
So let’s start with the example above. Why doesn’t it work? Inform tells me that gg_full_illustration is an udeclared variable – but it is declared, as a global variable.
Kind of at my wit’s end, here. This is the fifth or sixth completely different approach that I’ve tried, and I’m ready to conclude that my original assessment was correct: I do not understand Glk (or I6 inclusions) whatsoever.