Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
Sfml 2.0 how can i call a method a precise nomber of times each seconds?
Print
Pages: [
1
]
Author
Topic: Sfml 2.0 how can i call a method a precise nomber of times each seconds? (Read 1142 times)
0 Members and 1 Guest are viewing this topic.
ayzed
Newbie
Posts: 9
Sfml 2.0 how can i call a method a precise nomber of times each seconds?
«
on:
April 30, 2012, 03:28:30 am »
Let's say that i want to call the draw method less than other methods so i can have more cpu for those other methods like updating movement or collision,how can i do it?can i have a working exemple?
thanx in advance
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11030
Re: Sfml 2.0 how can i call a method a precise nomber of times each seconds?
«
Reply #1 on:
April 30, 2012, 07:43:13 am »
sf
::
Clock
clock
;
while
(
window.
isOpen
(
)
)
{
if
(
clock
.
elapsedTime
(
)
.
asSeconds
(
)
>=
1
.
f
)
{
// Do your stuff every second.
clock
.
reset
(
)
;
}
}
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
Sfml 2.0 how can i call a method a precise nomber of times each seconds?
anything