Cleaned the timeline code up nicely.
This commit is contained in:
@ -7,35 +7,15 @@
|
||||
|
||||
#include "game.h"
|
||||
|
||||
timeline_t TIMELINE_TEST;
|
||||
|
||||
void onStart(timeline_t *tl) {
|
||||
printf("Action started %f\n", tl->current);
|
||||
}
|
||||
|
||||
void onDuration(timeline_t *tl) {
|
||||
printf("Action duration %f\n", tl->current);
|
||||
}
|
||||
|
||||
void onEnd(timeline_t *tl) {
|
||||
printf("Action ended %f\n", tl->current);
|
||||
}
|
||||
|
||||
bool gameInit(game_t *game) {
|
||||
// Init the game
|
||||
game->name = GAME_NAME;
|
||||
|
||||
// Init the engine and the rendering pipeline
|
||||
engineInit(&game->engine, game);
|
||||
|
||||
timelineInit(&TIMELINE_TEST);
|
||||
timelineaction_t *action = timelineAddAction(&TIMELINE_TEST, 1, 1);
|
||||
action->onStart = &onStart;
|
||||
action->onDuration = &onDuration;
|
||||
action->onEnd = &onEnd;
|
||||
|
||||
// Hand off to the poker logic.
|
||||
// pokerInit(&game->poker, &game->engine);
|
||||
pokerInit(&game->poker, &game->engine);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -45,15 +25,8 @@ bool gameUpdate(game_t *game, float platformDelta) {
|
||||
engineUpdateStart(&game->engine, game, platformDelta);
|
||||
|
||||
// Hand off to the poker logic
|
||||
// pokerUpdate(&game->poker, &game->engine);
|
||||
|
||||
timelineUpdate(&TIMELINE_TEST, platformDelta);
|
||||
if(timelineIsFinished(&TIMELINE_TEST)) {
|
||||
printf("Timeline finished\n");
|
||||
} else {
|
||||
printf("Timeline not finished\n");
|
||||
}
|
||||
|
||||
pokerUpdate(&game->poker, &game->engine);
|
||||
|
||||
// Hand back to the engine.
|
||||
return engineUpdateEnd(&game->engine, game);
|
||||
}
|
||||
|
Reference in New Issue
Block a user