Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Sketch Pad Ray 3.0
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
r.m_spy




PostPosted: Sun Mar 07, 2010 8:49 pm   Post subject: Sketch Pad Ray 3.0

about time
Improvments: Change in size is changed by a button. You need to click to draw( no more sloppy frawing), no random eraser

to view my old sketch pad, click bellow
http://compsci.ca/v3/viewtopic.php?t=16626&highlight=sketch+pad
code:
%RAY SKETCH PAD 3.0
% Made by Raymond Mendelovis(r.m_spy) (please give credit)
%
%
%
% CONTROLS
% Left click to draw
% Press up or down to change color
var x,y,x1,y1,btn,cl,size:int
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 enter:char:=chr(10)
var space:char:=chr(32)
var d2:char:=chr(100)
cl:=1
size:=3
loop
delay(10)
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(q) then
if size<100 then
size:=size+1
end if
elsif k(a) then
if size>1 then
size:=size-1
end if
end if
if k(enter) then
cls
end if
if btn=1 then
drawfilloval(x,y,size,size,cl)
end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
r.m_spy




PostPosted: Sun Mar 07, 2010 8:49 pm   Post subject: RE:Sketch Pad Ray 3.0

Please, feel free to comment on features sketch pad 4.0 should have
Euphoracle




PostPosted: Sun Mar 07, 2010 9:43 pm   Post subject: RE:Sketch Pad Ray 3.0

Why is this '3.0' it isn't even complete for '1.0' Razz

But here, I'll be constructive: Rather than drawing ovals, try drawing 'thick lines' so that when the user drags the cursor fast, it doesn't skip over areas and draw far-apart dots.
TerranceN




PostPosted: Sun Mar 07, 2010 9:45 pm   Post subject: Re: Sketch Pad Ray 3.0

Continous lines. Right now, if I move my mouse at any reasonable speed it makes gaps in where I draw, like the picture I attached named SketchPadBefore.png. It should look like the "After" picture I attached. In order to achieve this you need to know some trigonometry. cosd(angle) will give you the amount to move in the x-axis and sind(angle) will give you the amount to move in the y-axis, such that the resulting length of that movement is always one. Therfore multiplying these values by the same number will multiply the length. If we know how far it is from the previous mouse position to the current mouse position, and what angle it is from the previous position to current position, we just have to put a dot at each unit along that angle. In the diagran I posted dots (or circles) would be drawn at:
previousMouseX + cosd(30) * 0, previousMouseY + sind(30) * 0
previousMouseX + cosd(30) * 1, previousMouseY + sind(30) * 1
previousMouseX + cosd(30) * 2, previousMouseY + sind(30) * 2
previousMouseX + cosd(30) * 3, previousMouseY + sind(30) * 3
Note that the last line will equal the current mouse position. Also notice that the only thing that changes is the distance, which makes it easy to put into a for loop. I hope that helps.

EDIT: @Euphoracle: Wow, I didn't know turing had thick lines built in. That makes it way easier than what I said.



SketchPadDiagram.png
 Description:
 Filesize:  8.92 KB
 Viewed:  6941 Time(s)

SketchPadDiagram.png



SketchPadAfter.png
 Description:
 Filesize:  44.96 KB
 Viewed:  198 Time(s)

SketchPadAfter.png



SketchPadBefore.png
 Description:
 Filesize:  44.27 KB
 Viewed:  194 Time(s)

SketchPadBefore.png


USEC_OFFICER




PostPosted: Sun Mar 07, 2010 9:54 pm   Post subject: RE:Sketch Pad Ray 3.0

There was a simple way to find the distance. I however, can't remember. But you can try to divide the ride/run by cosd(angle)/sind(angle). It should work.
r.m_spy




PostPosted: Sun Mar 07, 2010 11:10 pm   Post subject: RE:Sketch Pad Ray 3.0

forgot a control

press q to increase in size, and a to decrease in size

ps: thanks for the comments, and ill input that formula in skech pad 4

pps: sketch pad one was a simple program where when you clicked it drawed a oval. no options. to bad to post

oh, and can I have the entire code, cause Im not pro, and I can't figure out where that text goes
Euphoracle




PostPosted: Mon Mar 08, 2010 12:17 am   Post subject: RE:Sketch Pad Ray 3.0

Well then you wouldn't learn anything. The idea is that you implement it ?)
copthesaint




PostPosted: Mon Mar 08, 2010 12:45 am   Post subject: Re: Sketch Pad Ray 3.0

You need to spend more time in this before you can even call this a submission lol. This is something I could do in 5 min, spend some more time before you post a program.

for example why should i use your program instead of the one I made a long while ago?
http://compsci.ca/v3/viewtopic.php?t=20226&highlight=
Sponsor
Sponsor
Sponsor
sponsor
r.m_spy




PostPosted: Mon Mar 08, 2010 6:56 am   Post subject: RE:Sketch Pad Ray 3.0

To cop the saint:

Your program is pretty impressive, but the main fault is you don't post the code, and when you dont, others cannot edit, or help you. then your left with flaws.

2, how do you change the size?
Euphoracle




PostPosted: Mon Mar 08, 2010 11:51 am   Post subject: RE:Sketch Pad Ray 3.0

Why should anyone use any of these went Microsoft Paint is technically superior to both? It isn't about usability or epeen, copthesaint, it's about learning.
r.m_spy




PostPosted: Mon Mar 08, 2010 4:20 pm   Post subject: RE:Sketch Pad Ray 3.0

1) microsoft paint cannot draw random circles like I do, and it would take a lot of time to overlap colors

2) why make programs if other people made better ones? beacause you are in control, meaning you can create cheats, charecters,and have whatever you like happen. Plus: you can add suttle features that most people miss out on, that look really good?

A few cool things you can do on Sketch Pad Ray 3.0 that take hours on paint

1) move the mouse across the screen while pressing up of down

2) Move the mouse across the screen while pressing q

3)edit the code, and do whatever!
copthesaint




PostPosted: Mon Mar 08, 2010 6:19 pm   Post subject: RE:Sketch Pad Ray 3.0

1 Im saying why should I use his turing based paint compaired to mine, DUH. lol I would never use ANY in real life! -.- I have adobe master suite Cs4, I have photo shop ;p

2 Im glad you took the time to read the thread...*Sarcasm* download the second post... I ALWAYS, AND I DO MEAN ALWAYS! include source code. :/ So dont give me that bull shit; However I didnt ALWAYS comment, I do now though. Smile

3 Dont be like turing gamer ;p *hope he reads this* , and always *try* to help people, When they DONT want or need it! That being said, DONT REVIVE MY PAINT PROGRAM!!! lol I would prefer it stayed past. It was cool making, but shitty programing now that I look back on it.

Btw Im Smile so I hope you realise Im trying to point out your errors nicley Smile and not trying to offend. Now Ive got to run.
*hides in a different thread from turing gamer who will surly try to make an excuse.* ;p I hope a mod doesnt give away my hiding spot.

Edit: Still needs more time spent on it before it is considered as a program no matter what your intentions are... lol.
This would be a good idea for the 20 lines or less contest, who can make the best paint program in 20 lines or less.
TerranceN




PostPosted: Mon Mar 08, 2010 7:29 pm   Post subject: Re: RE:Sketch Pad Ray 3.0

r.m_spy @ Sun Mar 07, 2010 11:10 pm wrote:
oh, and can I have the entire code, cause Im not pro, and I can't figure out where that text goes


There is no specific spot "where that text goes", I was just explaining that method of creating a thick line. If you read the explaination, you should be able to figure out how to implement that method in your code. If you don't care how it works, then just use Draw.ThickLine(x1, y1, x2, y2, thickness, colour) as mentioned earlier. Of course if you are trying to understand, but my crappy explaination is making it hard, here is a better explaination (although it will require significantly more reading).

@copthesaint:
I agree with Euphoracle, this is not about making the best program ever, its about learning. Sure this is not the most amazing submission ever, but if the OP learns something from it, and isn't spamming these kinds of programs, I see no problem with it.
r.m_spy




PostPosted: Mon Mar 08, 2010 8:03 pm   Post subject: Sketch Pad Ray 3.5

still havent perfected the line, but here is what I added

1)menu bar(all options easy)
2)save/load (saves the picture in memory, then you can load it on top of your picture.
3) color box/size number

code:

%RAY SKETCH PAD 3.0
% Made by Raymond Mendelovis(r.m_spy) (please give credit)
%
%
%
% CONTROLS
% Left click to draw
% Press up or down to change color
% Press q and e to change size
% Press s to save, and l to load
import GUI in "%oot/support/lib/GUI"
var x,y,x1,y1,btn,cl,size:int
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: int
var menuItem : array 1 .. 17 of int
var menuName : array 1 .. 17 of string (10) := init ("New", "Save", "Load", "White", "Black",
"Red" , "Blue", "Green", "---","Color Up","Color Down", "Small","Moderate", "Big", "---",
"Size Up", "Size Down")
procedure MenuSelected
    for i : 1 .. 17
        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
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
picID:=Pic.New(0,0,maxx,maxy)
loop
delay(10)
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(q) then
if size<100 then
size:=size+1
end if
elsif k(a) then
if size>1 then
size:=size-1
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(s) then
picID:=Pic.New(0,0,maxx,maxy)
end if
if k(l) then
Pic.Draw(picID,0,0,picMerge)
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

ps:I'm in grade 9
Euphoracle




PostPosted: Mon Mar 08, 2010 9:34 pm   Post subject: Re: RE:Sketch Pad Ray 3.0

copthesaint @ Mon Mar 08, 2010 6:19 pm wrote:
1 Im saying why should I use his turing based paint compaired to mine, DUH. lol I would never use ANY in real life! -.- I have adobe master suite Cs4, I have photo shop ;p

2 Im glad you took the time to read the thread...*Sarcasm* download the second post... I ALWAYS, AND I DO MEAN ALWAYS! include source code. :/ So dont give me that bull shit; However I didnt ALWAYS comment, I do now though. Smile

3 Dont be like turing gamer ;p *hope he reads this* , and always *try* to help people, When they DONT want or need it! That being said, DONT REVIVE MY PAINT PROGRAM!!! lol I would prefer it stayed past. It was cool making, but shitty programing now that I look back on it.

Btw Im Smile so I hope you realise Im trying to point out your errors nicley Smile and not trying to offend. Now Ive got to run.
*hides in a different thread from turing gamer who will surly try to make an excuse.* ;p I hope a mod doesnt give away my hiding spot.

Edit: Still needs more time spent on it before it is considered as a program no matter what your intentions are... lol.
This would be a good idea for the 20 lines or less contest, who can make the best paint program in 20 lines or less.


ugh you post worst than ecookman
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 20 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: