Glimmr Simple Graphics Window

version 1/100805 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Basic Usage

    Glimmr Simple Graphics Window creates a graphics g-window of the kind "graphics g-window" (see Flexible Windows). GSGW does not set any default settings for the window, and also does not open it. So, after including the extension, we need to, at minimum, open the window. To do this at the beginning of the game:

        When play begins:
            open up the graphics-window.

    In the absence of other settings, this will open a vertically oriented window with a black background, to the right of the main window. Use the standard Flexible Windows g-window properties to change these defaults, e.g.:

        The back-colour of the graphics-window is g-Lavender.
        The position of the graphics-window is g-placeabove.

    The window created by GSGW is called the "graphics-window".

    If GSGW is not used with Glimmr Canvas-Based Drawing, only a bare bones window-drawing rule is provided. This rule, the "clear the graphics-window rule", does nothing but clear the window to its background color. To amplify the window-drawing routine, add another window-drawing rule:

        A window-drawing rule for the graphics-window:
            let win_width be the width of the graphics-window;
            let win_height be the height of the graphics-window;
            let img_width be the image-width of the current image;
            let img_height be the image-height of the current image;
            (etc.)

    The example game below includes a complete drawing rule and supporting code that will display an image centered in the window (scaling it down to fit if necessary).