<para>
Glk does all its user-interface work in a function called glk_select(). This function waits for an event — typically the player's input — and returns an structure representing that event. This means that your program must have an event loop. In the very simplest case, you could write
</para>
-<informalexample>
-<programlisting>
+|[
void glk_main()
{
- #event_t ev;
+ event_t ev;
while (1) {
- #glk_select(&ev);
+ glk_select(&ev);
switch (ev.type) {
default:
/* do nothing */
}
}
}
-</programlisting>
-</informalexample>
+]|
<para>
This is a legal Glk-compatible program. As you might expect, it doesn't do anything. The player will see an empty window, which he can only stare at, or destroy in a platform-defined standard manner.
</para>