Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sardius2

Render/Input Manager

This topic is 5408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have recently learned I cannot just render frames during idle time, and update input as often as I render, since the slower/faster the fps is, the slower/faster the movement is. Does anyone know of a good book/tutorial/website or anything that helps introduce to rendering and input managing? I would appreciate it.

Share this post


Link to post
Share on other sites
Advertisement
Well...

I use Visual Basic, and the method I''ve found for making the game run at a consistent rate is quite simple.

I presume that once a frame is rendered, you execute the game loop code? Well, put this into a separate Sub.

Now, what I do is to use the API call GetTickCount. This returns the number of "ticks" (miliseconds) since the PC powered up.

I also store the LAST tick count into a Long Integer as a backup.

Let''s say that you want to run the game loop every 15 miliseconds:


LastTickCount = GetTickCount ''(otherwise it''ll run VERY fast at the beginning)

Do
Render ''Render the 3D stuff

For x = 1 to (GetTickCount - LastTickCount) / 15
GameLoop ''Run the game code.
Next x
LastTickCount = GetTickCount

Loop

(I think that should work... well, it''s what I use...)
Play around with it!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!