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

Username:   Password: 
 RegisterRegister   
 Colour selector/identifier
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Drakain Zeil




PostPosted: Wed Dec 22, 2004 4:24 pm   Post subject: Colour selector/identifier

You can pick your nose, you can pick your friends, and now you can (easily) pick colours.

code:
View.Set ("graphics:320;340,position:center;center,nobuttonbar")

var c := 0
for cy : 1 .. 320 by 20
    for cx : 1 .. 320 by 20
        Draw.FillBox (cx, cy, cx + 20, cy + 20, c)
        c += 1
    end for
end for

var x, y, b : int
loop
    for cy : 0 .. 300 by 20
        for cx : 0 .. 300 by 20
            Mouse.Where (x, y, b)
            if (cx < x and x < cx + 20) and (cy < y and y < cy + 20) then
                c := (cx div 20) + ((cy div 20) * 16)
                %c := (ceil (x / 20) + (ceil (y / 20) * 16))
                Text.Locate (1, 1)
                colour (c)
                put "Sample text ", repeat ("-", maxcol - 17), " " ..
                colour (black)
                put c
            end if
        end for
    end for
end loop


It's a simple 30~ line program, displays all of the 256 colours you can use in turing, mouseover them for that colour to be output at the top. I think I was going to do somthing with the "b" variable... meh, it's nothing now.
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Wed Dec 22, 2004 5:27 pm   Post subject: (No subject)

nice. try this

code:

var cont : string(1)
for c:0..255
drawfilloval (320,240,25,25,c)
locatexy (320,200)
put c
getch (cont)
end for


P.S. press any key to move on to the next colour
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  [ 2 Posts ]
Jump to:   


Style:  
Search: