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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Zinidane

Pages: [1]
1
System / Re: Framerate regulation question
« on: January 31, 2018, 08:35:41 pm »
I'm not sure i understand your question. I'll redirect you to the article that helped me understand, it really is a good read on the subject. It starts from what I told you and there's more after.

http://gameprogrammingpatterns.com/game-loop.html

Now I realize that the frameTime variable in my example is poorly named. It should have been timeElapsed because it represents how much time the game loop took to execute and render.

16.67 ms is the time the frame should take to have 60 of them in a second. (16.67 * 60 = 1000.2 ms)
So if your game loop took 4 ms, you should sleep 16.67 - 4 = 12.67 ms until the next frame, thus enforcing 60 fps.

EDIT : You will realize with more reading on the subject that the sleep method is not exact so it's pretty hard to have EXACTLY 60fps. With this method you'll have around 59 - 61 fps. close enough

2
SFML projects / Re: Flappy-Bird Clone Attempt
« on: January 31, 2018, 06:36:08 pm »
Those are linking problems. Could be multiple thing

1. Did you set the right library search path in your project ?
2. Did you set the right libraries in the compiler settings (sfml_xxxx_xx.lib and stuff)
3. Did you put the dlls in your project (if you did not use SFML_STATIC)

if there's something you don't understand in those 3 steps, read or watch the setup guide carefully. Good luck

3
System / Re: Framerate regulation question
« on: January 31, 2018, 06:27:56 pm »
One way to do it is to calculate the time it takes a frame to render, and wait the remaining time until the next frame, in order to have let's say 60 of them in a second (60 fps = 16.67 ms per frame) . So in order to do that  you want to :

1. Get the clock time in a variable (frameStartTime = some clock function)
2. Do your game loop
3. check how much time passed (frameTime = clock function - frameStartTime)
4. It will probably be less than 16.67 ms (for 60fps) so you want to wait the difference (Sleep(16.67 - frameTime))
5.Rinse and repeat

Now that's only the basic idea behind it, it's not perfect but i hope it helps you.

EDIT : btw this method does not really cap the frame rate to 60 but rather enforce a frame rate of 60.

4
SFML projects / Re: [Release][GUI] SFML + ImGui lib
« on: January 30, 2018, 06:43:28 pm »
Just integrated it to my project... works great !

I want to do a tilemap like your example and i'm wondering how you did it ? Did you use a imagebutton for each tile ? Selectable something ?

Pages: [1]