3 #include "musk/engine.h"
4 #include "musk/scene.h"
5 #include "musk/image.h"
6 #include "musk/animation.h"
7 #include "musk/timer.h"
9 // TODO: Find a way to copy the SDL framework AND the resources
11 int main(int argc
, char **argv
)
16 using musk::Animation
;
20 Engine
engine("../resources/main.lua");
23 Scene
scene(Image("../resources/background.png"));
25 Actor
hero(Animation("../resources/hero.png", 2));
26 hero
.setPosition(4, 24);
29 uint32_t fps
= engine
.fps();
35 while (quit
== false) {
38 // TODO: let the engine handle the events
39 while (SDL_PollEvent(&event
) == 1) {
40 if (event
.type
== SDL_QUIT
) {
46 break; // TODO: or save the game?
49 scene
.draw(engine
.screen());
51 if (timer
.ticks() < (1000.0 / fps
)) {
52 SDL_Delay((1000.0 / fps
) - timer
.ticks());
55 scene
.step(timer
.ticks());