Added timeline

This commit is contained in:
2021-07-15 09:22:38 -07:00
parent 81a79e136d
commit 9e40d8f576
8 changed files with 189 additions and 10 deletions

View File

@ -7,15 +7,35 @@
#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;
}
@ -25,7 +45,14 @@ bool gameUpdate(game_t *game, float platformDelta) {
engineUpdateStart(&game->engine, game, platformDelta);
// Hand off to the poker logic
pokerUpdate(&game->poker, &game->engine);
// pokerUpdate(&game->poker, &game->engine);
timelineUpdate(&TIMELINE_TEST, platformDelta);
if(timelineIsFinished(&TIMELINE_TEST)) {
printf("Timeline finished\n");
} else {
printf("Timeline not finished\n");
}
// Hand back to the engine.
return engineUpdateEnd(&game->engine, game);

View File

@ -9,7 +9,7 @@
#include "../poker/poker.h"
#include "../poker/card.h"
#include "../util/array.h"
#include "../display/animation/timeline.h"
/**
* Initialize the game context.