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

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




PostPosted: Sat Aug 29, 2009 3:17 pm   Post subject: Clocks

playing around with turings time functions made some clocks,
the side clock was an odd attempt, not to fond of it but meH



Clocks.zip
 Description:

Download
 Filename:  Clocks.zip
 Filesize:  1.05 MB
 Downloaded:  408 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
apomb




PostPosted: Wed Oct 14, 2009 10:12 am   Post subject: RE:Clocks

I actually really like the idea of the side clock, it might not be the most practical, but definitely unique.
SNIPERDUDE




PostPosted: Wed Oct 14, 2009 11:20 am   Post subject: RE:Clocks

I really like these, the analog clock (first one) is really nice. The choppiness of it woks really well with it too.

The other two analog clocks are really nice in geometry, but I feel they're lacking some colour. Same goes for the side clock - cool idea, but some colour would be that polish at the end.

Great job.
petree08




PostPosted: Thu Oct 15, 2009 6:12 am   Post subject: RE:Clocks

meh, i have bland aesthetic tastes, black and white and or base color on black is all i want to deal with, that being said in the procedure that draws the clocks there is a parameter that governs the color of each part of the clock
i wish i didn't post the side clock, it really does look bad,
apomb




PostPosted: Thu Oct 15, 2009 8:17 am   Post subject: RE:Clocks

would you be willing to post the source of the clocks for customization?
petree08




PostPosted: Thu Oct 15, 2009 11:04 am   Post subject: RE:Clocks

yeas sir, well here is a version that didn't use the parameters for color,
i misplaced the other ones

code:



procedure Draw_Clock_Face (Size, X, Y : int, TimeOfDay : string)

    const COLOR_CLOCK := 10
    const CLOCK_HAND_COLOR := 2
    var Hour, Minute, Second : nat

    Second := strnat (TimeOfDay (7 .. 8))
    Minute := strnat (TimeOfDay (4 .. 5))
    Hour := strnat (TimeOfDay (1 .. 2))


    drawoval (X, Y, Size, Size, COLOR_CLOCK)


    drawoval (X, Y, 75, 75, COLOR_CLOCK)
    % drawfilloval (X, Y, 50, 50, COLOR_CLOCK)

    drawarc (X, Y, Size + 30, Size + 30, round (360 + (15 * (360 / 60)) - (Second * (360 / 60))) - 135,
        round (360 + (15 * (360 / 60)) - (Second * (360 / 60))) + 135, COLOR_CLOCK)
    drawarc (X, Y, Size + 10, Size + 10, round (360 + (15 * (360 / 60)) - (Minute * (360 / 60))) - 90,
        round (360 + (15 * (360 / 60)) - (Minute * (360 / 60))) + 90, COLOR_CLOCK)
    drawarc (X, Y, Size, Size,
        round ((360 + (15 * (360 / 60)) - (Hour * (360 / 12)) - (Minute * (360 / 60 / 12)))) - 45,
        round ((360 + (15 * (360 / 60)) - (Hour * (360 / 12)) - (Minute * (360 / 60 / 12)))) + 45, COLOR_CLOCK)


    for Hours : 1 .. 12

        drawline (X +
            round (cosd (360 + (15 * (360 / 60)) - (Hours * (360 / 12))) * (Size - 13)),
            Y +
            round (sind (360 + (15 * (360 / 60)) - (Hours * (360 / 12))) * (Size - 13)),
            X +
            round (cosd (360 + (15 * (360 / 60)) - (Hours * (360 / 12))) * Size),
            Y +
            round (sind (360 + (15 * (360 / 60)) - (Hours * (360 / 12))) * Size), COLOR_CLOCK)
    end for

    for Mins : 1 .. 60

        drawline (X +
            round (cosd (360 + (15 * (360 / 60)) - (Mins * (360 / 60))) * (70)),
            Y +
            round (sind (360 + (15 * (360 / 60)) - (Mins * (360 / 60))) * (70)),
            X +
            round (cosd (360 + (15 * (360 / 60)) - (Mins * (360 / 60))) * 80),
            Y +
            round (sind (360 + (15 * (360 / 60)) - (Mins * (360 / 60))) * 80), COLOR_CLOCK)
    end for


    %SECOND HAND
    % drawfillarc (X, Y, Size, Size, round (360 + (15 * (360 / 60)) - (Second * (360 / 60))) - 90,
    %     round (360 + (15 * (360 / 60)) - (Second * (360 / 60))) + 90, 12)
    drawline (X +
        round (cosd (360 + (15 * (360 / 60)) - (Second * (360 / 60))) * (Size - 75)),
        Y +
        round (sind (360 + (15 * (360 / 60)) - (Second * (360 / 60))) * (Size - 75
        )),
        X +
        round (cosd (360 + (15 * (360 / 60)) - (Second * (360 / 60))) * (Size + 30)),
        Y +
        round (sind (360 + (15 * (360 / 60)) - (Second * (360 / 60))) * (Size + 30)), CLOCK_HAND_COLOR)
    %minute hand
    Draw.ThickLine (X +
        round (cosd (360 + (15 * (360 / 60)) - (Minute * (360 / 60))) * (Size - 75)),
        Y +
        round (sind (360 + (15 * (360 / 60)) - (Minute * (360 / 60))) * (Size - 75
        )),
        X +
        round (cosd (360 + (15 * (360 / 60)) - (Minute * (360 / 60))) * (Size + 10)),
        Y +
        round (sind (360 + (15 * (360 / 60)) - (Minute * (360 / 60))) * (Size + 10)), 2, CLOCK_HAND_COLOR)

    %hour hand
    Draw.ThickLine (X +
        round (cosd (360 + (15 * (360 / 60)) - (Hour * (360 / 12)) - (Minute * (360 / 60 / 12))) * (Size div 2)),
        Y +
        round (sind (360 + (15 * (360 / 60)) - (Hour * (360 / 12)) - (Minute * (360 / 60 / 12))) * (Size div 2)),
        X +
        round (cosd (360 + (15 * (360 / 60)) - (Hour * (360 / 12)) - (Minute * (360 / 60 / 12))) * Size),
        Y +
        round (sind (360 + (15 * (360 / 60)) - (Hour * (360 / 12)) - (Minute * (360 / 60 / 12))) * Size), 2, CLOCK_HAND_COLOR)

    drawoval (X, Y, 5, 5, COLOR_CLOCK)
    drawfilloval (X, Y, 2, 2, 7)
end Draw_Clock_Face

%analog clock


var TimeOfDay : string
var Font1 := Font.New ("System:24")
var Date : string

setscreen ("graphics:280,280,nobuttonbar,offscreenonly")
colorback (7)
loop
    cls
    time (TimeOfDay)

    Date := Time.Date
    Draw_Clock_Face (100, maxx div 2, maxy div 2, TimeOfDay)
    if strint (TimeOfDay (1 .. 2)) > 12 then
        Font.Draw (intstr (strint (TimeOfDay (1 .. 2)) - 12) + TimeOfDay (3 .. *) + " PM", 1, 1, Font1, 0)
    else
        Font.Draw (TimeOfDay + " AM", 1, 1, Font1, 0)

    end if
    Font.Draw (Date (1 .. 9), maxx - 125, maxy - 20, Font1, 0)
    View.Update
end loop



the draw commands are pretty messy, alot of trig was needed
petree08




PostPosted: Thu Oct 15, 2009 11:05 am   Post subject: RE:Clocks

the color parameter isn't there, but the constants within the sub do the same thing
Kharybdis




PostPosted: Thu Oct 15, 2009 11:59 am   Post subject: RE:Clocks

Nice Clocks, i have to admit. I don't know why you don't think the line idea is good... it's awesome! It's like a timeline.
Sponsor
Sponsor
Sponsor
sponsor
petree08




PostPosted: Thu Oct 15, 2009 12:05 pm   Post subject: RE:Clocks

i dunno,
i just don't like the look of it, with it's beady eyes and bad mustache
apomb




PostPosted: Thu Oct 15, 2009 1:21 pm   Post subject: RE:Clocks

Thank you for the source.
SNIPERDUDE




PostPosted: Thu Oct 15, 2009 1:44 pm   Post subject: RE:Clocks

Thanks for the source, I'll take a look at it when I get home.
petree08




PostPosted: Wed Oct 21, 2009 1:57 pm   Post subject: RE:Clocks

if anyone has a good example of a countdown clock i would appreciate the code. Or even just a general walkthough of how to do it,

example counting down the years/monts/days/hours/minutes/seconds until a certain day.
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  [ 12 Posts ]
Jump to:   


Style:  
Search: