Glimmr Graphic Hyperlinks

version 1/100805 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Part 2 - Basic Input
        
    A g-window can be g-graphlinked. A g-window is usually not g-graphlinked.

    A graphlink g-window is a kind of graphics g-window. A graphlink g-window is g-graphlinked.

    After constructing a g-window (called the window-in-question):
        if the window-in-question is g-graphlinked and the type of the window-in-question is g-graphics:
            start looking for graphlinks in the window-in-question.

    To start looking for graphlinks in (g - a g-window):
        (- SetGraphLink({g}); -)

    To stop looking for graphlinks in (g - a g-window):
        (- IgnoreLinks({g}); -)

    To cancel input in main window:
        (- CancelMainEvents(); -)

    To decide which number is the clicked window reference:
        (- (gg_event-->1) -)
        
    The first glulx mouse input rule (this is the identify window rule):
        now glulx replacement command is "";
        Repeat with item running through g-graphlinked g-windows:
            if the ref-number of item is the clicked window reference:
                now the current graphlink window is item.
                
    A glulx mouse input rule (this is the default graphlink setting rule):
        perform glulx graphlink request in current graphlink window.
        
    To perform glulx graphlink request in (g - a graphics g-window):
        (- if (glk_gestalt(gestalt_MouseInput, winType_Graphics)) DoGraphLink({g}); -)
        
    Include (-

    [ DoGraphLink g;
        SetGraphLink(g);
        PlayGraphlink(gg_event-->2, gg_event-->3);
    ];

    [ PlayGraphlink x y;
        (+ current graphlink x +) = x;
        (+ current graphlink y +) = y;
        FollowRulebook( (+ clicking graphlink rules +) );
    ];

    [CancelMainEvents ;
        glk_cancel_line_event(gg_mainwin, GLK_NULL);
        glk_cancel_char_event(gg_mainwin);
    ];

    [ SetGraphLink g;
        if (g.ref_number) {
         if (glk_gestalt(gestalt_MouseInput, winType_Graphics)) glk_request_mouse_event(g.ref_number);
        }
    ];

    [ IgnoreLinks g;
        if (g.ref_number) {
         if (glk_gestalt(gestalt_MouseInput, winType_Graphics)) glk_cancel_mouse_event(g.ref_number);
        }
    ];

    -)