Pequena correção no Makefile
[Projeto-PCG.git] / controle.cpp
blob0cfa4ab3ca58ad88c56427c859478f8432fc7dec
1 #include "controle.h"
2 #include "usereventtype.h"
4 Controle::Controle(Player &p) : jogador( p ) {
5 quit = false;
8 void Controle::handleEvents() {
9 SDL_Event e;
10 while( SDL_PollEvent( &e ) ) {
11 switch( e.type ) {
12 case SDL_USEREVENT:
13 switch (e.user.code) {
14 case FUNCTIONCALL:{
15 void (*p) (void*) = (void (*)(void*))e.user.data1;
16 p(e.user.data2);
18 break;
19 default: handleEvent(e); break;
21 break;
22 case SDL_QUIT:
23 quit = true;
24 break;
25 case SDL_KEYDOWN:
26 switch (e.key.keysym.sym) {
27 case SDLK_F5:
28 jogador.game->reloadLua();
29 break;
30 case SDLK_F6:
31 jogador.setPosition(jogador.game->getSpawn().x,jogador.game->getSpawn().y);
32 break;
33 default: handleEvent(e);break;
35 break;
36 default:
37 handleEvent(e);
38 break;
41 handleOther();