Flexible Windows

version 13/130803 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next

  • Chapter 5 - Writing to different windows

    Section - Shifting and knowing where we are

    [ Updated code by Erik Temple. ]

    The current g-window is a g-window that varies. The current g-window is the main-window.

    To set/move/shift the/-- focus to (g - a g-window), clearing the window:
    if g is g-present
    now the current g-window is g;
    set cursor to ref-number of g;
    if clearing the window, clear the current g-window;
    end if.

    To set cursor to the/-- (N - a number):
    (- glk_set_window({n}); -)

    To clear the/-- (win - a g-window):
        if the type of win is g-graphics:
            graphics-clear win;
            text-clear win.

    To text-clear the/-- (g - a g-window):
    (- if ({g} has g_present) glk_window_clear({g}.ref_number); -).

    To graphics-clear the/-- (g - a g-window):
    (- if ({g} has g_present) BlankWindowToColor({g}); -).

    Include (-

    [ BlankWindowToColor g result graph_width graph_height col;
    col = ColVal(g.back_colour);
    result = glk_window_get_size(g.ref_number, gg_arguments, gg_arguments+WORDSIZE);
    graph_width = gg_arguments-->0;
    graph_height = gg_arguments-->1;

    glk_window_fill_rect(g.ref_number, col, 0, 0, graph_width, graph_height);