Glulx Input Loops

version 1/101121 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Section - I7 phrase wrappers

    To wait for glk input:
        (- glk_select(gg_event); -)
    To decide which g-event is the current glk event:
        (- gg_event-->0 -)
    To decide which number is the window of the current glk event:
        (- gg_event-->1 -)
    To decide what number is the character code returned:
        (- gg_event-->2 -)

    To decide what number is glk event handled in (ev - a g-event) context:
        (- HandleGlkEvent(gg_event, {ev}, gg_arguments) -)

    To set jump point HandleGlkEvent:
        (- .HGEContinue; -)
    To jump to HandleGlkEvent:
        (- jump HGEContinue; -)

    To decide whether the supplied window is the input window:
        repeat with item running through g-windows:
            if the ref-number of item is the window of the current glk event:
                decide yes.

    To cancel pending line event in (win - a g-window):
        if line event pending is true:
            cancel line input in win, preserving keystrokes;
            say "[line break][run paragraph on]";[needed for Zoom—other terps insert line break automatically. This results in double breaks for other interpreters, but there doesn't seem to be any way around the problem.]
            now line event pending is false.

    To update the status line:
        (- DrawStatusLine(); -)

    To print prompt:
        (- PrintPrompt(); -)