Menu

Creating window and simple cycle

jabberx

Here is updated program. Compile it and run. Play with parameters. You can find detailed description of all functions in README.html


#include \<lsdl>


int main ()

    createWindow ( 640, 480 )

    setWindowTitle ( "Test" )

    // main cycle

    while true

        // clears with yellow color

        clearWindow ( 0xFFFF00 )

        // set color to draw filled rectangle

        setColor ( 0xFF0000 )

        // drawing filled rectangle

        drawFillRect ( 100, 170, 200, 300 )

        // drawing non-filled rectangles with different line width

        drawRect ( 150, 100, 50, 50, 5 )

        drawRect ( 250, 100, 50, 50, 15 )

        // showing everything what was drawn above

        updateWindow ()

        // this is how we handle events

        handle events

            if window was closed

                quit ()

                return 0

    return 0


Related

Tutorials: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.