Skip to main content
gamedev.net
🔒 Locked

Render/Input Manager

Started by Sardius2 Sep 4, 2003 at 1:41 AM 0 replies 500+ views
Original Post
Sardius2
Sardius2
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.
Alan
benryves
benryves
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!
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.