TGC Codebase Backup



Simple 2D box, filled box, and semi by jayandy

30th Sep 2004 19:48
Summary

Simple 2D box, filled box, and semi-filled circle drawing



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    ` Main Loop
sync on
x1 = 5
y1 = 10
x2 = 25
y2 = 30
Draw_FIlledSquare(x1,x2,y1,y2)
sync
Draw_Square(300,100,478,278)
sync
Draw_FIlledcircle(200,200,90)
sync

wait key

Function Draw_Square(x1,x2,y1,y2)
    Line x1,y1,x2,y1
    Line x2,y1,x2,y2
    Line x2,y2,x1,y2
    Line x1,y2,x1,y1
EndFunction

Function Draw_FilledSquare(x1,x2,y1,y2)

   Dx = x2 - x1
   For i = 0 To Dx
     Line x1+i,y1,x1+i,y2
   Next i

EndFunction

Function Draw_FilledCircle(x,y,radius)
   For i = 0 to radius
      Circle x,y,i
   Next i
EndFunction