Starting a clock collection...

Share your advanced PureBasic knowledge/code with the community.
dige
Addict
Addict
Posts: 1405
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Post by dige »

Cool :D
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

For anybody who is interested, I just noticed that Michael's original code specified the font "MS Trebuchet".
This is incorrect, and Windows substitutes another font, which doesn't look very good.
The correct font name is "Trebuchet MS". Using this font looks much better.

Thanks again, Michael, for a great piece of code!

Regards,
Eric
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

You guys are welcome to my numbers if you like them:

http://www.lloydsplace.com/numbers2.png

I use GrabImage to cut them in half. The slots on the sides are for a little turning wheel to fit in, like you see in some flip clocks. I like a little more mechanical complication, I think it adds to the look. (you'll have to make your own wheel).
BERESHEIT
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Looks like the 108min timer in the series "Lost"

Quick! type in the code! :D
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

Hi,
just made some enhancements for the screensaver, some are maybe interesting:

• fonts are not that smooth, so I draw larger images and shrink it using the ImageResize function (just play around with smooth=0, 1 or 2 in the ini file)
• TextHeight() is still a problem, how to center "pure" vertically (lower case)
• I tried to add some rectangles on both sides to get a more realistic look, just play around with the configuration slider called "Klappen"
• you have a slow graphic card? Write "Quick=1" into the ini file

Michael
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

A day or so before Michael posted this excellent code, my son asked me to get him up at 4 am for a trip to the city and he thought he'd likely sleep through his alarm. It just buzzes. So I downloaded the loudest ring I could find from a sounds forum I belong to and wrote him a little clock that would jangle him out of bed for sure. It took ten minutes and just had a text gadget for the time. When this thread appeared I thought, why not make a skin and a proper clock out of it? So I did. It doesn't have as good a transition effect as Michael's does but it's ok and probably as good as it's going to get. The only thing it doesn't do yet is ring when it's time, which is kind of funny because the only thing the first one did was ring and after 2 days work this one does everything except ring. Anyway, for anyone interested, here's what I have so far:

http://lloydsplace.com/alarmclock.zip

Please let me know of any problems or bugs.
BERESHEIT
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

netmaestro wrote:The only thing it doesn't do yet is ring when it's time [...]
Please let me know of any problems or bugs.
What a nice clock :shock:, well done! (I like the glass effect 8))

I started it immediately and there are just some (small) points...
• I got no alarm here, how have you implemented the alarm-check? (within an own thread, one check each second, check includes the seconds etc.)
• I could not stop the program using "Alt-F4" or "Esc"
• maybe "am" or "pm" should be seen also in the alarm time display

Michael


The alarm function should work using something like this...

Code: Select all

Enumeration
	#AlarmOff
	#AlarmOn
	#AlarmActive
EndEnumeration

Global AlarmMode=#AlarmOn
Global ActualTime.s=FormatDate("%hh:%ii",Date())
Global OldTime.s
Global AlarmTime.s=FormatDate("%hh:%ii",Date()/60*60+60)


Repeat

	Delay(200)
	
	ActualTime.s=FormatDate("%hh:%ii",Date())

	If ActualTime<>OldTime

		OldTime=ActualTime
		Debug ActualTime+" (Alarm at "+AlarmTime+")"

		Select AlarmMode

		Case #AlarmOn
			If ActualTime=AlarmTime
				Debug "* * * ALARM * * *"
				Beep_(1000,1000)
				AlarmMode=#AlarmActive
			EndIf

		Case #AlarmActive
			Debug "Alarm stopped, next Alarm at "+AlarmTime
			AlarmMode=#AlarmOn

		EndSelect

	EndIf

ForEver
User avatar
Michael Vogel
Addict
Addict
Posts: 2807
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

I had some free time to finish this clock type for now, it grew over 2000 lines of code (slightly more than expected at the beginning :lol: )

Here it is, feel free to play around with configs (you should click around in the dialog to find all configuration settings 8) )...

PureBasic Screen Saver Clock
Post Reply