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

Username:   Password: 
 RegisterRegister   
 Cool Drawing Program
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
decon1985




PostPosted: Tue Jun 07, 2005 12:43 pm   Post subject: Cool Drawing Program

code:

var winID1, winID2 : int



var x, y, b, rnd, rnb : int := 1
var c : int := 0
var chars : array char of boolean
var n, m : int
var x2, y2 : int := 0
winID1 := Window.Open ("position:0,320,graphics:400;200,title:Window 1")
winID2 := Window.Open ("position:0,0,graphics:400;280,title:Help Window")

Window.Select (winID2)
put "JUST PUSH AND HOLD ONE OF THESE BUTTONS"
put "AND CLICK AND HOLD TO DRAW: "
put "Clear Tool = 0"
put "Eraser Tool = e"
put "Small Random tool =1"
put "Medium Random tool =2"
put "Large Random tool =3"
put "Small Tool = 4"
put "Medium Tool = 5"
put "Large Tool = 6"
put "Red Tool = 7"
put "Blue Tool = 8"
put "Yellow Tool = 9"
put "Random Tool = r"
put "Star Tool = s"
put "Box Tool = b"

Window.SetActive (winID1)
setscreen ("graphics:max;max,nobuttonbar")
var font1 : int
font1 := Font.New ("Comic Sans MS:40")
var font2 : int
font2 := Font.New ("Comic Sans MS:25")

drawfillbox (0, 0, maxx, maxy, black)
colour (11)
colourback (black)

Font.Draw ("THE GREATEST DRAWING", 50, 300, font1, 12)
Font.Draw ("PROGRAM IN THE WORLD", 50, 240, font1, 12)
Font.Draw ("By: Devin Foulds", 250, 190, font2, 45)
Font.Free (font1)
Font.Free (font2)


    delay(2000)
setscreen ("offscreenonly;")

for j : 1 .. maxx

    drawfillbox (0, 0, 0 + j+ (j div 2), 0 + j, 0)
   

   
   
 
    View.Update
end for

drawfillbox (0, 0, maxx, maxy, white)
colour (1)
colourback (white)


put "Open the 'Help Window' at the bottom for instructions."
put "(Draw slowly for best results.)"

View.Update

loop

    for i : 1 .. 100

        n := Rand.Int (10, 70)
        m := Rand.Int (10, 70)

        mousewhere (x, y, b)
        if (x not= rnd or y not= rnb) and b = 1 then

            %%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('0') then
                cls
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('e') then
                drawfilloval (x, y, 10, 10, 0)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('1') then
                drawfilloval (x, y, 5, 5, c)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('2') then
                drawfilloval (x, y, 20, 20, c)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('3') then
                drawfilloval (x, y, 40, 40, c)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('r') then
                drawfilloval (x, y, n, m, c)
                delay (10)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('s') then
                x2 := Rand.Int (0, 100)
                y2 := Rand.Int (0, 100)
                drawfillstar (x + x2, y + y2, x - x2, y - y2, c)
                delay (20)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('g') then
                drawfilloval (x + i, y + i, 1 + i, 1 + i, c)
                delay (50)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('b') then
                x2 := Rand.Int (0, 100)
                y2 := Rand.Int (0, 100)
                drawfillbox (x + x2, y + y2, x - x2, y - y2, c)
                delay (50)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('4') then
                drawfilloval (x, y, 5, 5, 255)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('5') then
                drawfilloval (x, y, 10, 10, 255)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('6') then
                drawfilloval (x, y, 20, 20, 255)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('7') then
                drawfilloval (x, y, 5, 5, 12)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('8') then
                drawfilloval (x, y, 5, 5, 45)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            Input.KeyDown (chars)
            if chars ('9') then
                drawfilloval (x, y, 5, 5, yellow)
            end if
            %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            c := (c + 1) mod 20
            rnd := x
            rnb := y
       
            View.Update
             end if

    end for


end loop
Sponsor
Sponsor
Sponsor
sponsor
decon1985




PostPosted: Tue Jun 07, 2005 2:04 pm   Post subject: Just Talkin'....

Well, Im the creator of this Program. I hope you guys enjoy it. This is my averagly large program, so go easy on the harsh critisism please. Wink
Delos




PostPosted: Tue Jun 07, 2005 2:38 pm   Post subject: (No subject)

1)
Please use [code] or [syntax] tags. Edit your post and insert them.
That or attach a file.

2)
Pleaes do not double post. If you had anything to say, you could say it in your original post, after the [code] tags were inserted.
[Gandalf]




PostPosted: Tue Jun 07, 2005 3:57 pm   Post subject: (No subject)

Good start for a paint program! Just make sure you change the fact that you have to press both mouse and choice.
decon1985




PostPosted: Tue Jun 07, 2005 5:35 pm   Post subject: Ok Then...

Well first of all, when I made that extra post I was really just trying to test out my picture. I will also change the code tags and syntax. Rolling Eyes
fehrge




PostPosted: Wed Jun 08, 2005 4:02 pm   Post subject: (No subject)

Really neat program. I like how you have the help window.
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 1  [ 6 Posts ]
Jump to:   


Style:  
Search: