Glimmr Canvas Editor

version 1/100805 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Part - Editor Startup
                
    The first editor turn is a number that varies. [This gives us a flag we can compare to the turn count; we use it to decide whether to allow UNDO. We don't allow undo for the turn immediately after the player has moved from the introductory quiz to the editor.]
                
    This is the editor startup rule:
        clear the main-window;
        repeat with item running through image-based fonts:
            if the number of rows in the font table of item is 1, next;
            increase the built-in resources index by the number of rows in the font table of item;
        initialize dynamic sprites;
        if portrait orientation is true:
            set windows to portrait orientation;
        update binary UI elements;
        open editor windows;
        follow the advance time rule;
        change the first editor turn to the turn count;
        print the editor startup text;
        say line break;
        say introductory commands;
        let current-tab be the current tab;
        if current-tab is:
            -- select_tab: try select-tab clicking;
            -- move_tab: try move-tab clicking;
            -- scale_tab: try scale-tab clicking;
        follow the window-drawing rules for the control-window;
        reject the player's command.

    To decide whether we have custom images:
        if the number of dynamic-sprites is greater than 1, decide yes;
        decide no.

    To open editor windows:
        if we have custom images:
            open up the library-window;
        otherwise if portrait orientation is false:
            now the measurement of the control-window is 27;
        open up the editor-window;
        open up the layers-window;
        open up the control-window;
        if we have custom images:
            open up the paging-window;
        open up the drawing-window;
        set the background of the status window to colored;
        set the background color of the status window to g-lightpear;
        open the status window.
        
    To set windows to portrait orientation:
        now the measurement of the library-window is 18;
        now the measurement of the editor-window is 55;
        now the position of the editor-window is g-placeleft;
        now the position of the control-window is g-placebelow;
        now the measurement of the layers-window is 4;
        now the measurement of the help-window is 15.
        
    To print the/-- editor startup text:
        say "Source code will be output targeting the canvas [italic type][targeted canvas][roman type], measuring [canvas-width of the working canvas] by [canvas-height of the working canvas] pixels[if we have custom images and the background image of the working canvas is Figure of Null]. If desired, you may select an image from the image library to serve as the background of the composition; simply select the image in the editor and press the Image Background button in the Settings tab[otherwise]. The image [italic type][background image of the working canvas][roman type] defines the background grid[end if]. To change the background color of the window type CHANGE CANVAS BACKGROUND COLOR TO <glulx color value>.";
            
    To say introductory commands:
        say "To make changes to your responses to the introductory settings, you may use the following commands:[paragraph break]RENAME WINDOW <desired name>[line break]RESIZE CANVAS TO <width in pixels> BY <height in pixels>[line break]".
        
    Every turn when library-window is g-present:
        follow the window-drawing rules for the library-window;
        
    To refresh windows:
        follow the refresh windows rule;