MODULE Essai1;

FROM tigr IMPORT TigrPtr,tigrWindow,tigrFree,tigrClosed, tigrClear, tigrUpdate, TPixelType,
                tigrLine, TK_ESCAPE, tigrKeyDown, tigrReadChar, tfont, tigrPrint,tigrFill,
                tigrCircle, tigrRect, tigrFillCircle,  tigrTime, tigrError;
FROM helper IMPORT tigrRGB, tigrRGBA;
FROM InOut IMPORT Write, WriteLn, WriteString, WriteCard;
FROM RealInOut IMPORT WriteShortReal;
FROM DynamicStrings IMPORT String, InitString;
FROM Delay IMPORT Delay;

VAR 
    screen : TigrPtr;
    redColor, blueColor, greenColor, blueColorHalf : TPixelType;
    message1, message2, message3 : String;


BEGIN
    message1 := InitString("Hello");
    message2 := InitString("Bonjour tout le monde!");
    message3 := InitString("How are you all?");
    WITH redColor DO 
        r := 255;
        g := 0;
        b := 0;
        a := 255;
    END;
    WITH blueColor DO
        r := 65;
        g := 105;
        b := 225;
        a := 255;
    END;
    WITH blueColorHalf DO
        r := 65;
        g := 105;
        b := 225;
        a := 128;
    END;
    WITH greenColor DO
        r := 0;
        g := 128;
        b := 0;
        a := 255;
    END;
    screen := tigrWindow(1000, 800, message1, 0);
     WriteShortReal(tigrTime(),8); WriteLn;
    WHILE (NOT (tigrClosed(screen) > 0)) OR (tigrKeyDown(screen, TK_ESCAPE) > 0) DO 
        tigrClear(screen, tigrRGB(80H, 90H, 0A0H));
        tigrLine(screen, 10, 10, 300, 500, redColor );
        IF (tigrKeyDown(screen, ORD("a")) > 0) THEN
            tigrLine(screen, 100, 100, 300, 500, blueColor );
        END;
        Write ( CHR(tigrReadChar(screen)));
        tigrPrint(screen, tfont, 10, 10, redColor, message2);
        tigrPrint(screen, tfont, 150, 150, blueColor, message3);
        tigrFill(screen,200,200,250,250,blueColorHalf);
        tigrCircle(screen, 600, 600,50,greenColor);
        tigrRect(screen, 250,250,250,250,blueColorHalf);
        tigrFillCircle(screen,500,500, 25,redColor );
        tigrFillCircle(screen,600,600, 25,blueColorHalf );
        tigrUpdate(screen);
    END;
    WriteShortReal(tigrTime(),8);WriteLn;
    tigrError(screen, "The window is closed! Messager used to display errors.");
    tigrFree(screen);
END Essai1.