Code Example: 
"An Animated Menu"

This example demonstrates the use of graphics, animation and text to create a spiced up menu that allows the user to select an option using the controller buttons. This is just to show what's possible (and to give you something while I finish buying a house, which takes up most of my time at the mo') - next we'll work the ideas in this program into general purpose functions that you can add to your 'library' in one of the case studies.

open window 640,512
zc=12
hm=zc+10
draw=1
for xc=-100 to 190 step 10
    yc=100
    if(200 -xc) > 11 then
        zc=200-(xc)
        hm=zc+10
    endif

    setdispbuf draw
    draw = 1 - draw
    setdrawbuf draw
    clear window

    setrgb 1,110,0,50
    setrgb 2,110,0,50
    gtriangle 450-xc,50 to 450-xc+200,50 to 450-xc,350

    setrgb 1, 255,255,255
    text 50,75,"What is the capital of China?"

    setrgb 1,30,30,30
    setrgb 1,0,0,255
    line xc,yc to xc+zc,yc+zc
    line xc,yc+zc to xc+zc,yc
    setrgb 1,255,255,255
    text xc+zc+10,yc+zc,"Pjon-Jang"
    yc=yc+hm
    setrgb 1,255,0,0

    circle xc+(zc/2),yc+(zc/2),(zc/2)+1

    setrgb 1,255,255,255
    text xc+zc+10,yc+zc,"Peking"

    yc=yc+hm
    setrgb 1,0,255,0
    triangle xc+(zc/2),yc to xc,yc+zc to xc+zc,yc+zc

    setrgb 1, 255,255,255
    text xc+zc+10,yc+zc,"Bejing"

    yc=yc+hm
    setrgb 1,255,100,100
    rectangle xc,yc to xc+zc,yc+zc

    setrgb 1,255,255,255
    text xc+zc+10,yc+zc,"Hong-Kong"

next xc
inkey$

 

(c) 2001 Arwin van Arum

"Sony" and "Playstation 2" are registered trademarks owned by Sony Inc.

"Tekken" and "Bust-A-Groove" are registered trademarks and are owned by Namco.