32 lines
749 B
C++
32 lines
749 B
C++
#include "jgame.h"
|
|
#include "jdraw.h"
|
|
#include "jinput.h"
|
|
#include <SDL2/SDL.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
game::init();
|
|
input::init();
|
|
|
|
bool should_exit=false;
|
|
SDL_Event e;
|
|
while (!should_exit)
|
|
{
|
|
uint8_t keyp=SDL_SCANCODE_UNKNOWN, keydown=SDL_SCANCODE_UNKNOWN;
|
|
while(SDL_PollEvent(&e))
|
|
{
|
|
if (e.type==SDL_QUIT) { should_exit = true; break; }
|
|
if (e.type==SDL_KEYDOWN)
|
|
{
|
|
keydown = e.key.keysym.scancode;
|
|
}
|
|
if (e.type==SDL_KEYUP)
|
|
{
|
|
keyp = e.key.keysym.scancode;
|
|
}
|
|
}
|
|
input::update(keydown,keyp);
|
|
if (!game::loop()) should_exit = true;
|
|
}
|
|
return 0;
|
|
} |