Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to display a digital clock on SFML window?  (Read 5704 times)

0 Members and 1 Guest are viewing this topic.

ngocdung93

  • Newbie
  • *
  • Posts: 6
    • View Profile
How to display a digital clock on SFML window?
« on: December 05, 2013, 08:07:45 pm »
Can you help me with displaying a digital clock? With both minute and second please.

Raincode

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: How to display a digital clock on SFML window?
« Reply #1 on: December 05, 2013, 08:59:46 pm »
My first attempt would be time(0) from ctime and sf::Text

maidis

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • SFML Geliştirme
Re: How to display a digital clock on SFML window?
« Reply #2 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]
[4]
[5] https://github.com/Gjum/BinClock
« Last Edit: December 05, 2013, 11:44:22 pm by maidis »

ngocdung93

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to display a digital clock on SFML window?
« Reply #3 on: December 06, 2013, 02:56:16 am »
thanks u very much. i'll give it a try

ngocdung93

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to display a digital clock on SFML window?
« Reply #4 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

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to display a digital clock on SFML window?
« Reply #5 on: December 06, 2013, 08:17:19 am »
Draw the clock after the texture?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

ngocdung93

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How to display a digital clock on SFML window?
« Reply #6 on: December 06, 2013, 11:29:18 am »
ok i got it.thanks you all.

 

anything