Graphical Window Sprites

version 1 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Part 3a - Sprite Drawing and Hyperlink Management (for use with Graphic Links by Jeff Sheets)
        
    To draw the/-- active sprites:
        Let L be the list of display-active sprites;
        sort L in display-layer order;
        zero the link-table;
        repeat with current-sprite running through L:
            let cur-sprite be sprite-identity of current-sprite;
            let x-temp be entry 1 of the sprite-coordinates of the current-sprite scaled by the window-scaling factor;
            let y-temp be entry 2 of the sprite-coordinates of the current-sprite scaled by the window-scaling factor;
            let x-coord be x-temp real plus window x-offset as an integer;
            let y-coord be y-temp real plus window y-offset as an integer;
            unless using the preloaded sprites option:
                let temp be the image-width of cur-sprite;
                change the sprite-width of the current-sprite to temp;
                let temp be the image-height of cur-sprite;
                change the sprite-height of the current-sprite to temp;
            let x-temp be the sprite-width of current-sprite as a fixed point number;
            let y-temp be the sprite-height of current-sprite as a fixed point number;
            let x-int be x-temp real times the window-scaling factor real times the sprite-scaling factor of the current-sprite as an integer;
            let y-int be y-temp real times the window-scaling factor real times the sprite-scaling factor of the current-sprite as an integer;
            draw sprite cur-sprite at coordinates x-coord and y-coord with dimensions x-int and y-int;
            if current-sprite is graphlink-active:
                set a graphlink identified as current-sprite from x-coord by y-coord to (x-coord + x-int) by (y-coord + y-int) as the linked replacement-command of current-sprite.

    To zero the/-- link-table:
        repeat through the Table of Graphlink Glulx Replacement Commands:
            blank out the whole row.