Glimmr Drawing Commands

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Part - Primitives


    Chapter - Rectangles


    Section - Dimensioned rectangle
    [The dimensioned rectangle reflects Glulx Inform's I6-level rectangle command, which provides dimensions for the rectangle rather than start and endpoints.]

    To dimrectdraw (hue - a number) in (win - a g-window) at (x1 - a number) by/x (y1 - a number) with size/dimensions (width - a number) by/x (height - a number):
        (- DrawDimRect({hue}, {win}, {x1}, {y1}, {width}, {height}); -)

    To draw/display a/-- rectangle/rect (hue - a number) in (win - a g-window) at (x1 - a number) by/x (y1 - a number) with size/dimensions (width - a number) by/x (height - a number):
        dimrectdraw (hue) in (win) at (x1) by (y1) with size (width) by (height);
        #if utilizing Glimmr debugging;
        say "[>console][DC]Drawing a rectangle of color [hue] in [i][win][/i] with upper left ([x1], [y1]) and dimensions [width] by [height].[<]";
        #end if.

    To draw/display a/-- rectangle/rect (hue - a number) in (win - a g-window) at (coord1 - a list of numbers) with size/dimensions (width - a number) by/x (height - a number):
        let x1 be entry 1 of coord1;
        let y1 be entry 2 of coord1;
        draw a rectangle (hue) in (win) at (x1) by (y1) with size (width) by (height);

    To rect/rectangle (coord1 - a list of numbers) size (width - a number) by/x (height - a number):
        if the type of the current graphics window is not g-graphics:
            rule fails;
        let x1 be entry 1 of coord1;
        let y1 be entry 2 of coord1;
        draw a rectangle (current foreground-color) in current graphics window at x1 by y1 with size width by height;


    Include (-

    [ DrawDimRect hue win x1 y1 width height ;
        if (win.ref_number) {
            glk_window_fill_rect(win.ref_number, hue, x1, y1, width, height);
        }
    ];

    -).