Interactive Parsing

version 3 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 4 - Defining Colours and Fonts

    [ Set up the Glulx styles for suggestions, valid input and errors. ]

    Before constructing the key-window:
        establish colours for input text.
        
    To establish colours for input text:
        (- KeyUp(); -).

    Include (-

        [ KeyUp col col2 i writecol ;
        
    for (i = 0: i < style_NUMSTYLES : i++)
        glk_stylehint_set(wintype_textgrid, i, stylehint_ReverseColor, false);

            glk_stylehint_set(wintype_Textgrid, style_User1, stylehint_TextColor, ColVal( (+g-green+) ));
            glk_stylehint_set(wintype_Textgrid, style_User2, stylehint_TextColor, ColVal( (+g-red+) ));
            
            glk_stylehint_set(wintype_Textgrid, stylehint_Proportional, stylehint_TextColor, ColVal( (+g-red+) ));
            glk_stylehint_set(wintype_Textgrid, stylehint_Proportional, stylehint_Weight, 0);
            
            glk_stylehint_set(wintype_Textgrid, style_Normal, stylehint_TextColor, ColVal( (+g-black+) ));
            glk_stylehint_set(wintype_Textgrid, style_Input, stylehint_TextColor, ColVal( (+g-black+) ));
            glk_stylehint_set(wintype_Textgrid, style_Input, stylehint_Weight, 0);
            glk_stylehint_set(wintype_Textgrid, style_Input, stylehint_TextColor, ColVal( (+g-blue+) ));
            
    #ifdef DEBUG;
            glk_stylehint_set(wintype_Textgrid, style_Note, stylehint_TextColor, ColVal( (+ g-red +) ));
    #ifnot;
            glk_stylehint_set(wintype_Textgrid, style_Note, stylehint_TextColor, ColVal( (+ g-indigo +) ));
    #endif;

            glk_stylehint_set(wintype_Textgrid, style_Emphasized, stylehint_TextColor, ColVal((+ g-blue +)) );

            glk_stylehint_set(wintype_Textgrid, CURSOR_STYLE, stylehint_Weight, 2);
            glk_stylehint_set(wintype_Textgrid, CURSOR_STYLE, stylehint_TextColor, ColVal((+g-blue +)) );
            glk_stylehint_set(wintype_Textgrid, CURSOR_STYLE, stylehint_Oblique, 0 );
            
        ];

    -).