SFML community forums

Help => Graphics => Topic started by: ngocdung93 on December 05, 2013, 08:07:45 pm

Title: How to display a digital clock on SFML window?
Post by: ngocdung93 on December 05, 2013, 08:07:45 pm
Can you help me with displaying a digital clock? With both minute and second please.
Title: Re: How to display a digital clock on SFML window?
Post by: Raincode on December 05, 2013, 08:59:46 pm
My first attempt would be time(0) from ctime and sf::Text
Title: Re: How to display a digital clock on SFML window?
Post by: maidis on December 05, 2013, 10:29:30 pm
Probably not the best way to create clock with SFML but at least it'll give you an idea and a working example :) Here is example code [1] which mostly based on this analog clock [2]. And here is digital clock's screenshot [3]. Also I give a try to do a binary clock similar to this [4].

Edit: There is already a binary clock written with SFML [5].

[1] http://pastebin.kde.org/pee140834
[2] https://github.com/SFML/SFML/wiki/Source%3A-Analog-Clock
[3] (http://wstaw.org/m/2013/12/05/plasma-desktopAD1321.png)
[4] http://www.youtube.com/watch?v=SHwYsUWZLrI
[5] https://github.com/Gjum/BinClock
Title: Re: How to display a digital clock on SFML window?
Post by: ngocdung93 on December 06, 2013, 02:56:16 am
thanks u very much. i'll give it a try
Title: Re: How to display a digital clock on SFML window?
Post by: ngocdung93 on December 06, 2013, 03:43:32 am
if i have a texture and a clock, how could i bring the clock to the front? the texture is always in front of it and i can't see the clock
Title: Re: How to display a digital clock on SFML window?
Post by: Nexus on December 06, 2013, 08:17:19 am
Draw the clock after the texture?
Title: Re: How to display a digital clock on SFML window?
Post by: ngocdung93 on December 06, 2013, 11:29:18 am
ok i got it.thanks you all.