Computer Science Canada

skech pad 2.0

Author:  r.m_spy [ Sat Dec 01, 2007 12:17 pm ]
Post subject:  skech pad 2.0

const MOUSE_SMOOTHING := 5
var mouse_x, mouse_y, button : int := 0
var w:int:=1
var k:array char of boolean
var u:char:=chr(200)
var d:char:=chr(208)
var s:char:=chr(32)
var e:char:=chr(10)
var r:string
var old_mouse_x, old_mouse_y : real := 0
put"the intructions for scetch pad ray"
put""
put"put the mouse over the turing screen"
put"this will draw a line"
put""
put"to change a color, scroll up or down"
put"let go for that color"
put""
put"press the mouse to draw in paint"
put""
put"press space to get the box eraser"
put"press space again to return painting"
put"press enter to delete your whole screen"
put""
put"ready"
get r
cls
loop
Mouse.Where (mouse_x, mouse_y, button)
old_mouse_x := (old_mouse_x * (MOUSE_SMOOTHING - 1) + mouse_x) / MOUSE_SMOOTHING
old_mouse_y := (old_mouse_y * (MOUSE_SMOOTHING - 1) + mouse_y) / MOUSE_SMOOTHING
if Mouse.ButtonMoved("down") then
drawfillbox(round(old_mouse_x-5),round(old_mouse_y-5),round(old_mouse_x+5),round(old_mouse_y+5),w)
else
drawdot(round(old_mouse_x-1),round(old_mouse_y-1),w)
end if
Input.KeyDown(k)
if k(u) then
delay(100)
if w>253 then
w:=w-200
else
w:=w+1
end if
elsif k(d) then
delay(100)
if w<3 then
w:=w+200
else
w:=w-1
end if
elsif k(s) then

loop
Mouse.Where (mouse_x, mouse_y, button)
old_mouse_x := (old_mouse_x * (MOUSE_SMOOTHING - 1) + mouse_x) / MOUSE_SMOOTHING
old_mouse_y := (old_mouse_y * (MOUSE_SMOOTHING - 1) + mouse_y) / MOUSE_SMOOTHING
drawfillbox(round(old_mouse_x-5),round(old_mouse_y-5),round(old_mouse_x+5),round(old_mouse_y+5),white)
Input.KeyDown(k)
if k(e) then
cls
end if
exit when k(s) and Mouse.ButtonMoved("up")
end loop
elsif k(e) then
cls
end if
end loop

Author:  theiinsilence [ Mon Dec 03, 2007 4:46 pm ]
Post subject:  Re: skech pad 2.0

an ok program could use a litle work, btw it paints wheither the mouse is clicked or not, and another sugestion would be to use Input.Pause comand instead of getting the random variable "r" and not doing anything with it, keep trying Very Happy

Author:  darkangel [ Tue Dec 04, 2007 5:42 am ]
Post subject:  Re: skech pad 2.0

hehe hold down "space" and draw like crazy

Author:  Tallguy [ Mon Apr 14, 2008 12:08 pm ]
Post subject:  RE:skech pad 2.0

okay, wats the point?, good though

Author:  repsoccer16 [ Tue Apr 15, 2008 8:01 am ]
Post subject:  RE:skech pad 2.0

lol pretty good but ya really what's the point...you should try making an etch a sketch Razz

Author:  crysis [ Tue Apr 15, 2008 8:26 am ]
Post subject:  RE:skech pad 2.0

hey i played and i couldn't change colors

Author:  Michael516 [ Tue Apr 15, 2008 8:31 am ]
Post subject:  RE:skech pad 2.0

i couldn't either, all the scrolling did was make it bigger once and then did nothing else

Author:  crysis [ Tue Apr 15, 2008 8:34 am ]
Post subject:  RE:skech pad 2.0

ya its kind of messed up

Author:  nastynika [ Tue Apr 15, 2008 8:34 am ]
Post subject:  Re: skech pad 2.0

not bad a couple bugs to work out by the looks of it but not to shabby

Author:  r.m_spy [ Sun Sep 13, 2009 5:30 pm ]
Post subject:  RE:skech pad 2.0

Sorry, up and down changes color

Author:  andrew. [ Sun Sep 13, 2009 6:48 pm ]
Post subject:  RE:skech pad 2.0

Kinda weird, but cool at the same time.

P.S. Next time upload the code or put it in syntax tags like this:
code:
[syntax="Turing"]Your code goes here[/syntax]

Author:  r.m_spy [ Wed Mar 10, 2010 7:00 am ]
Post subject:  skech pad 3.0

code:

%Click Unlock, to unlock extra features
%Click Help(video) for instructions
import GUI in "%oot/support/lib/GUI"
var button1,unlock:int
unlock:=0
var x,y,x1,y1,btn,cl,size:int
var done:int:=0
var k:array char of boolean
var u:char:=chr(200)
var d:char:=chr(208)
var q:char:=chr(113)
var a:char:=chr(97)
var o:char:=chr(111)
var p:char:=chr(112)
var enter:char:=chr(10)
var space:char:=chr(32)
var d2:char:=chr(100)
var l:char:=chr(108)
var s:char:=chr(115)
var picID :int
cl:=1
size:=3
var first,second,third,forth,fifth: int
var menuItem : array 1 .. 21 of int
var menuName : array 1 .. 21 of string (11) := init ("New", "Save", "Load", "White", "Black",
"Red" , "Blue", "Green", "---","Color Up","Color Down", "Small","Moderate", "Big", "---",
"Size Up", "Size Down","Load BMP","Load JPG","Help(video)","Unlock")
procedure MenuSelected
    for i : 1 .. 21
        if menuItem (i) = GUI.GetEventWidgetID then
if i=1 then
drawfillbox(0,0,maxx,maxy-20,white)
elsif i=2 then
picID:=Pic.New(0,0,maxx,maxy)
elsif i=3 then
Pic.Draw(picID,0,0,picMerge)
elsif i=4 then
cl:=white
elsif i=5 then
cl:=black
elsif i=6 then
cl:=brightred
elsif i=7 then
cl:=brightblue
elsif i=8 then
cl:=brightgreen
elsif i=10 then
cl:=cl+1
elsif i=11 then
cl:=cl-1
elsif i=12 then
size:=3
elsif i=13 then
size:=25
elsif i=14 then
size:=100
elsif i=16 then
size:=size+1
elsif i=17 then
size:=size-1
elsif i=18 then
var Pic2:int
Pic2:=Pic.FileNew("Backround.BMP")
Pic.Draw(Pic2,0,0,picMerge)
elsif i=19 then
var Pic3:int
Pic3:=Pic.FileNew("Backround.JPG")
Pic.Draw(Pic3,0,0,picMerge)
elsif i=20 then
if Sys.Exec ("help.avi")then
end if
elsif i=21 then
if Sys.Exec ("http://www.time2play.comuf.com")then
unlock:=1
    GUI.Enable (forth)
    GUI.Enable (first)
    end if
end if
end if
    end for
end MenuSelected
first:=GUI.CreateMenu("File")
for cnt : 1 .. 3
    menuItem (cnt) := GUI.CreateMenuItem (menuName (cnt), MenuSelected)
end for
second:=GUI.CreateMenu("Color")
for cnt : 4 .. 11
    menuItem (cnt) := GUI.CreateMenuItem (menuName (cnt), MenuSelected)
end for
third:=GUI.CreateMenu("Size")
for cnt : 12..17
    menuItem (cnt) := GUI.CreateMenuItem (menuName (cnt), MenuSelected)
end for
forth:=GUI.CreateMenu("Extra Stuff")
for cnt : 18..20
    menuItem (cnt) := GUI.CreateMenuItem (menuName (cnt), MenuSelected)
end for
fifth:=GUI.CreateMenu("Unlock")
for cnt : 21..21
    menuItem (cnt) := GUI.CreateMenuItem (menuName (cnt), MenuSelected)
end for
picID:=Pic.New(0,0,maxx,maxy)
    GUI.Disable (forth)
    GUI.Disable (first)
loop
Mouse.Where(x,y,btn)
Input.KeyDown(k)
if k(u) then
if cl<200 then
cl:=cl+1
else
cl:=2
end if
elsif k(d) then
if cl>1 then
cl:=cl-1
else
cl:=200
end if
end if
if k(enter) then
drawfillbox(0,0,maxx,maxy-20,white)
end if
if btn=1 then
drawfilloval(x,y,size,size,cl)
end if
if k(a) then
size:=0
end if
if k(s) then
if unlock=1 then
picID:=Pic.New(0,0,maxx,maxy)
end if
end if
if k(o) then
x1:=x
y1:=y
loop
if btn=1 then
Draw.ThickLine(x1,y1,x,y,size,cl)
done:=1
end if
Mouse.Where(x,y,btn)
exit when done=1
end loop
done:=0
end if
if k(p) then
x1:=x
y1:=y
loop
if btn=1 then
drawfillbox(x1,y1,x,y,cl)
done:=1
end if
Mouse.Where(x,y,btn)
exit when done=1
end loop
done:=0
end if
if k(l) then
if unlock=1 then
Pic.Draw(picID,0,0,picMerge)
end if
end if
Text.LocateXY(maxx-140,maxy-15)
put"Size: ",size,", Color:"
drawbox(maxx-16,maxy-16,maxx-4,maxy-4,black)
drawfillbox(maxx-15,maxy-15,maxx-5,maxy-5,cl)
    exit when GUI.ProcessEvent
end loop
[/code]

Author:  USEC_OFFICER [ Wed Mar 10, 2010 12:02 pm ]
Post subject:  RE:skech pad 2.0

1: No explaination. Why did you post this?

2: Use The Turing syntax please.

Author:  peterchen1995 [ Sat Dec 18, 2010 5:53 pm ]
Post subject:  Re: skech pad 2.0

I also made a sketch pad Very Happy

Hope you enjoy it!


: