- Treballant en la ordenació de actors

This commit is contained in:
2023-03-01 18:57:45 +01:00
parent f54e5ebef5
commit 195fb39210
9 changed files with 194 additions and 7 deletions

View File

@@ -3,11 +3,23 @@
#include "jinput.h"
#include <SDL2/SDL.h>
namespace game
{
static unsigned int ticks_per_frame = 1000/60;
void setUpdateTicks(const int ticks)
{
ticks_per_frame = ticks;
}
}
int main(int argc, char *argv[])
{
game::init();
input::init();
static unsigned int current_ticks = SDL_GetTicks();
bool should_exit=false;
SDL_Event e;
while (!should_exit)
@@ -26,7 +38,12 @@ int main(int argc, char *argv[])
}
}
input::update(keydown,keyp);
if (!game::loop()) should_exit = true;
if (SDL_GetTicks()-current_ticks >= game::ticks_per_frame)
{
if (!game::loop()) should_exit = true;
current_ticks = SDL_GetTicks();
}
}
return 0;
}