TGC Codebase Backup



simple paint (no media) by chunks chunks

1st Jan 2007 16:53
Summary

simple paint program with 5 colours and pensize



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM Project: paint
REM Created: 1/1/2007 7:35:52 PM
REM
REM ***** Main Source File *****
REM
print "                    f1 to f5 for colours"
print "                  left & right for pensize"
print "                     spacekey to clear"
print "                      press any key"
wait key

cls


sync rate 0 :set window on
r=255
g=255
b=255

ink rgb(r,g,b),rgb(0,0,0)


pensize#=5.0

do
`create pen
a=mousex()
b=mousey()
   if mouseclick()=1 then pen(a,b,pensize#)


   if keystate(59)=1
   r=255
   g=0
   b=0
   ink rgb(r,g,b),rgb(0,0,0)
   endif

      if keystate(60)=1
      r=0
      g=255
      b=0
      ink rgb(r,g,b),rgb(0,0,0)
      endif

if keystate(61)=1
r=0
g=0
b=255
ink rgb(r,g,b),rgb(0,0,0)
endif

   if keystate(62)=1
   r=255
   g=255
   b=0
   ink rgb(r,g,b),rgb(0,0,0)
   endif

      if keystate(63)=1
      r=255
      g=255
      b=255
      ink rgb(r,g,b),rgb(0,0,0)
      endif

if leftkey()=1 then pensize#=pensize#-0.2
if rightkey()=1 then pensize#=pensize#+0.2
if pensize#=4.8 then pensize#=5.0

   if spacekey()=1 then cls


loop

function pen(x,y,r)

for count=1 to r
box x-count,y-sqrt((r^2)-(count^2)),x+count,y+sqrt((r^2)-(count^2))
next count
endfunction