Home Previous section Next section

Displaying graphics


Before you can show graphics images on the screen, you must call the SCREEN command. SCREEN sets the graphics mode.

The following program uses graphics mode 13 (320x200) to display a line, then returns back to text mode:
    SCREEN 13

    ' This starts at 10 pixels from the left, 10 from
    ' the top and goes to point (100, 100):

    LINE (10, 10)-(100, 100)

    WHILE INKEY$ = "": WEND  
    ' Waits until a key is pressed

    SCREEN 0  
    ' Returns to text mode

You can also draw a colored line.
    SCREEN 13

    LINE (10, 10)-(100, 100), 192  
    ' Dark green

    WHILE INKEY$ = "": WEND

    SCREEN 0

To draw a single pixel, use PSET.
    SCREEN 13

    PSET (160, 100)

    WHILE INKEY$ = "": WEND

    SCREEN 0

The following displays a circle at (160, 100) with a radius of 50:
    SCREEN 13

    CIRCLE (160, 100), 50

    WHILE INKEY$ = "": WEND

    SCREEN 0

Finally, to display a square, use LINE.
    SCREEN 13

    LINE (10, 10)-(100, 100), 192, B  
    ' Notice the B

    WHILE INKEY$ = "": WEND

    SCREEN 0

Next section


Feel free to distribute this tutorial, upload it to your website, link to it from your site, etc.

http://www.geocities.com/progsharehouse/qbtutor
Mirror: http://development.freeservers.com/qbtutor