|
-
September 3rd, 2011, 01:07 AM
#1
Update all instances of a class with a single funtion?
First of all, let me say that while I do know about classes and such, stuff like inheritance, templates, and other complex topics is pretty much beyond my level.
My Timer class structure looks like so:
Code:
class Timer
{
public:
double time;
void Update(void);
};
Update() increases time by however much time has passed since the last time Update() was called, normally every frame. time is public, so you can easilly set it to 0 to reset it, or grab it's current value directly, or even set it to a specific value if you need.
What I want is to call Update() only once, instead of once for every single instance of the class. This not only would clean up my code significantly, but it would speed it up too (less calls to QueryPerformanceCounter(), etc.)
Any advice?
Last edited by candlemaster; September 3rd, 2011 at 01:09 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|