X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=docs%2Freference%2Fglk-main-function.sgml;h=a1fef408650e7684aa9c0392afb210425afd2ccc;hb=06ddf48408b645a395390ba543f2cb241826896f;hp=e6f33e76855604bea92f5c18deb6b254cd7d4501;hpb=cae962752aef9b5edd99c7353842d18807d38fa9;p=projects%2Fchimara%2Fchimara.git diff --git a/docs/reference/glk-main-function.sgml b/docs/reference/glk-main-function.sgml index e6f33e7..a1fef40 100644 --- a/docs/reference/glk-main-function.sgml +++ b/docs/reference/glk-main-function.sgml @@ -33,13 +33,12 @@ You define a function called glk_main(), which the library calls to begin runnin 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 - - +|[ void glk_main() { - #event_t ev; + event_t ev; while (1) { - #glk_select(&ev); + glk_select(&ev); switch (ev.type) { default: /* do nothing */ @@ -47,8 +46,7 @@ void glk_main() } } } - - +]| 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.