CGE: Implemented code for game tick

This commit is contained in:
Paul Gilbert 2011-07-03 20:20:01 +10:00
parent 4116189395
commit ecad39e246
2 changed files with 14 additions and 0 deletions

View File

@ -45,6 +45,7 @@ enum {
class CGEEngine : public Engine {
private:
uint32 _lastFrame;
void tick();
public:
CGEEngine(OSystem *syst, const ADGameDescription *gameDescription);
~CGEEngine();

View File

@ -1537,8 +1537,21 @@ void CGEEngine::mainLoop() {
millis = g_system->getMillis();
}
_lastFrame = millis;
// Dispatch the tick to any active objects
tick();
}
void CGEEngine::tick() {
for (Sprite *spr = Vga->ShowQ->First(); spr; spr = spr->_next) {
if (spr->_time) {
if (!spr->_flags._hide) {
if (--spr->_time == 0)
spr->tick();
}
}
}
}
void CGEEngine::loadUser() {
// set scene