Monday, July 8, 2013

Your first Graphics Program

How to make my first graphics program?

Simplest graphics program has three parts:
1- Show the graphics screen
    to show graphics screen use SCREEN 1 command

2- Make your drawings
    invoke one or more drawing commands e.g. CIRCLE

3- Wait for some time in order to see the graphics before going back to text screen
    (text screen is restored automatically when program ends)
   you can for example use SLEEP command or make an infinite loop using GOTO command

Example:
    10 SCREEN 1
    20 CIRCLE 160, 200, 100, 1, 1
    30 SLEEP 10000
(the program ends after 10 seconds)


you can replace line 30 with:
    30 GOTO 30
(to stop the program the user has to tap on break button)

other choice will be using SLEEP and GOTO together
    30 SLEEP 200 : GOTO 30
(to stop the program the user has to tap on break button)

final resort is waiting user to tap some key on virtual keyboard
    30 GET K$
    40 IF K$ = "" THEN 30
(of course you can mix methods as needed)
Note: sample programs demonstrate using these methods.