trouble getting paint tools to work right....
Author |
Message |
Clayton
|
Posted: Tue May 02, 2006 10:44 pm Post subject: trouble getting paint tools to work right.... |
|
|
hey, for some reason in my paint program that i decided i wanted to do, the tools dont quite work right, they wont activate properly, could someone plz help with this and see if they could find the problem with my code?
Turing: |
/*
paint by Clayton Shier
May 2/06
just because i want to
*/
View.Set ("graphics")
var x, y, b : int %Mouse.Where vars
var clr : int := black
var choice : string := "b"
proc line (x, y : int)
const size : int := 10
Draw.Line (x - size, y - size, x + size, y + size, clr )
end line
proc box (x, y : int)
const size : int := 20
Draw.Box (x - size, y - size, x + size, y + size, clr )
end box
proc brush (x, y : int)
const RADIUS : int := 5
Draw.FillOval (x, y, RADIUS, RADIUS, clr )
end brush
proc sprayCan (x, y : int)
end sprayCan
proc erase (x, y : int)
const size : int := 20
Draw.FillBox (x - size, y - size, x + size, y + size, white)
end erase
proc fill
Draw.FillBox (82, 102, maxx, maxy, clr )
end fill
proc chooseColor (x, y : int)
const size : int := 50
clr := View.WhatDotColor (x, y )
Draw.FillBox (maxx - size * 2, 0, maxx, size, clr )
end chooseColor
proc shape (x, y : int)
if x >= 0 and y >= 0 and x <= 50 and y <= 50 then
choice := "e"
elsif x >= 0 and y >= 50 and x <= 50 and y <= 100 then
choice := "s"
elsif x >= 50 and y >= 0 and x <= 100 and y <= 50 then
choice := "f"
elsif x >= 50 and y >= 50 and x <= 100 and y <= 100 then
choice := "b"
elsif x >= 100 and y >= 0 and x <= 150 and y <= 50 then
choice := "bo"
else
choice := "l"
end if
end shape
proc decide (x, y, b : int)
if b = 1 then
if x >= 0 and y >= maxy - 280 and x <= 80 and y <= maxy then
chooseColor (x, y )
elsif x >= 0 and y >= 0 and x <= 150 and y >= 100 then
shape (x, y )
elsif x >= 82 and y >= 102 then
if choice = "f" then
fill
elsif choice = "b" then
brush (x, y )
elsif choice = "bo" then
box (x, y )
elsif choice = "e" then
erase (x, y )
elsif choice = "s" then
sprayCan (x, y )
else
line (x, y )
end if
end if
end if
end decide
proc drawClrSelect
const size : int := 20
var x, y, count : int := 0
x := 0
y := maxy - size
%draws the color palette available
for i : 0 .. maxcolor by 5
if count = 4 then
count := 0
x := 0
y - = size
end if
Draw.FillBox (x, y - size, x + size, y, i )
x + = size
count + = 1
end for
end drawClrSelect
proc drawOptnSelect
const size : int := 50
var x, y, count : int := 0
locatexy (7, 15)
put "Eraser" : 7, "Fill" : 7, "Box"
locatexy (7, 65)
put "Spray" : 7, "Brush" : 7, "Line"
for i : 1 .. 6
if count = 2 then
count := 0
y := 0
x + = size
end if
Draw.Box (x, y, x + size, y + size, black)
y + = size
count + = 1
end for
end drawOptnSelect
%Main Loop
drawClrSelect
drawOptnSelect
loop
Mouse.Where (x, y, b )
decide (x, y, b )
end loop
|
thnx in advance |
|
|
|
|
|
Sponsor Sponsor
|
|
|
NikG
|
Posted: Tue May 02, 2006 11:12 pm Post subject: (No subject) |
|
|
In your decide proc: code: | elsif x >= 0 and y >= 0 and x <= 150 and y >= 100 then | should be code: | elsif x >= 0 and y >= 0 and x <= 150 and y <= 100 then |
Also, your line code isn't working. |
|
|
|
|
|
|
|