Simple Graphical Window

version 8 by Emily Short

  • Home page
  • Beginning
  • Previous



  • Section 6 - Inform 7 Wrapper Phrases and Rules for Drawing

    To build graphics window:
        (- MakeGraphicsWindow(); -)

    Current graphics drawing rule is a rule that varies. The current graphics drawing rule is the standard placement rule.

    [By default we want to clear the screen to the established background color, then draw our image centered in the window, scaling it down to fit if necessary.]

    This is the standard placement rule:
        blank window to graphics background color;
        follow the centered scaled drawing rule.

    This is the bland graphics drawing rule:
        blank window to graphics background color;

    To blank the/-- graphics/-- window to (bc - a glulx color value):
        blank the graphics window to the assigned number of bc;

    To blank the/-- graphics/-- window to (bc - a number):
        (- BlankWindowToColor({bc}); -)

    [We can also use the centered scaled drawing rule on its own, without blanking out the background, if we want. This might be useful if, for instance, we want to fill the background with a tiled texture and then place a centered image over the top of it.]

    This is the centered scaled drawing rule:
        draw centered scaled image in graphics window.

    To draw centered scaled image in graphics window:
        (- MyRedrawGraphicsWindows(); -)

    [And here's the rule for tiling an image:]

    This is the tiled drawing rule:
        draw tiled image in graphics window.

    To draw tiled image in graphics window:
        (- TileFillGraphicsWindows(); -)

    [And for scaling the image to fit the graphics window, without preserving aspect ratio but simply filling all the available space:]

    This is the fully scaled drawing rule:
        draw fully scaled image in graphics window.

    To draw fully scaled image in graphics window:
        (- TotalFillGraphicsWindows(); -)

    [The purpose of this design is to allow authors to add their own rules for drawing graphics should the provided ones be thought insufficient, without needing to replace the entire extension. To do this, create a rule with a different name, a To... phrase to call an I6 function, and the I6 function itself, emulating the format used here.]

    Simple Graphical Window ends here.