Glimmr Canvas Editor

version 1/100805 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Part - Initial Questionnaire

    Interrogation is a kind of value. The interrogations are q-canvas, q-width, q-height, and q-complete.

    Quiz-ongoing is a truth state that varies.
    Skipped-intro is a truth state that varies. Skipped-intro is false.

    Stage is an interrogation that varies.

    The startup text is a text variable. Startup text is usually "Welcome to the Glimmr Canvas Editor. This is a utility intended to help you arrange graphical elements into a composition for use with the Glimmr library and the Flexible Windows extension. Once your composition is complete, you may export complete, compilable Inform 7 source code that will replicate your composition.[paragraph break]"

    The user-specified startup text is text that varies.

    This is the print the editor startup text rule:
        say "[line break][startup text][user-specified startup text][startup instructions text]";
        now quiz-ongoing is true;
        now stage is q-width;
        follow the intro quiz control rule.

    The startup instructions text is a text variable. The startup instructions text is usually "To begin, maximize your window to its full size. Then, answer the following questions about the canvas you will be creating. (If you prefer, you can just type SKIP to go straight to the editor; all of these settings can be also be specified directly from the editor.)[paragraph break]".
        
    The print the editor startup text rule is listed after the display banner rule in the startup rules.
        
    Every turn when quiz-ongoing is true (this is the intro quiz control rule):
        if stage is q-canvas:
            now current question is "[italic type]What is the name of the canvas that you will be editing? (This is used to customize the output source code.)[roman type]";
            now current prompt is "Enter the name of a canvas (e.g., graphics-canvas): >";
            ask a closed question, in text mode;
        if stage is q-width:
            now current question is "[italic type]What is the width of your canvas? If you intend to use one of the images in the editor's library to define your canvas, you may type SKIP to go directly to the editor.[roman type]";
            now current prompt is "Enter a number: >";
            ask a closed question, in number mode;
        if stage is q-height:
            now current question is "[italic type]What is the height of your canvas?[roman type]";
            now current prompt is "Enter a number: >";
            ask a closed question, in number mode;
                
    After reading a command when quiz-ongoing is true and the player's command matches "skip" or the player's command matches "no" (this is the skipping intro quiz rule):
        now skipped-intro is true;
        abide by the intro-quiz completion rule;
        rule succeeds;
        
    The skipping intro quiz rule is listed first in the after reading a command rules.
        
    A text question rule when the stage is q-canvas (this is the window-prompting rule):
        now targeted canvas is the current answer;
        if targeted canvas is "":
            now the targeted canvas is "graphics-canvas";
        say "Thank you. The canvas will be called the [i]targeted canvas[/i]. The output source code will assign this canvas to a window called the 'graphics-window', but you may easily replace this with a window of your choosing.";
        now stage is q-width;
        exit.
            
    A number question rule when the stage is q-width (this is the width-prompting rule):
        if the number understood is less than 1:
            say "Please enter a number greater than 0.[line break]";
            retry;
        say "Thank you. The canvas will be [the number understood] units wide.";
        now the canvas-width of the working canvas is the number understood;
        now stage is q-height;
        exit.

    A number question rule when the stage is q-height (this is the height-prompting rule):
        if the number understood is less than 1:
            say "Please enter a number greater than 0.[line break]";
            retry;
        say "Thank you. The canvas will be [the number understood] units high.";
        now the canvas-height of the working canvas is the number understood;
        now stage is q-complete;
        abide by the intro-quiz completion rule.
        
    This is the intro-quiz completion rule:
        if stage is q-complete:
            say "Thank you. Press any key to go to the editor.";
        otherwise:
            say "[line break][bracket]Input canceled.[close bracket] Press any key to go to the editor.";
        now quiz-ongoing is false;
        now stage is q-complete;
        change the command prompt to the saved prompt;
        change the current prompt to "";
        now number question mode is false;
        now text question mode is false;
        if canvas-height of working canvas > canvas-width of working canvas:
            now portrait orientation is true;
        wait for any key;
        follow the editor startup rule;