2010-04-05 23:38:59 +02:00
|
|
|
#include "Controller.h"
|
2010-09-11 02:28:50 +02:00
|
|
|
#include "AsteroidsEvents.h"
|
2010-04-05 23:38:59 +02:00
|
|
|
|
|
|
|
namespace asteroids {
|
|
|
|
|
|
|
|
int Controller::OnInit (int argc, char *argv[]) {
|
|
|
|
Engine::ControllerBase::OnInit (argc, argv);
|
|
|
|
|
|
|
|
mBindings[SDLK_q] = "quit";
|
|
|
|
|
|
|
|
mBindings[SDLK_v] = "+forward";
|
|
|
|
mBindings[SDLK_h] = "+turnleft";
|
|
|
|
mBindings[SDLK_g] = "+turnright";
|
|
|
|
|
|
|
|
mBindings[SDLK_SPACE] = "attack";
|
|
|
|
|
|
|
|
mBindings[SDLK_F8] = "toggleconsole";
|
|
|
|
mBindings[SDLK_F9] = "set playerspeed 5.0";
|
|
|
|
|
2010-11-28 01:13:45 +01:00
|
|
|
Engine::RegisterListener (this, EventChangeViewState);
|
2010-09-11 02:28:50 +02:00
|
|
|
|
2010-04-05 23:38:59 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-11 02:28:50 +02:00
|
|
|
bool Controller::OnReceiveEvent (const Engine::EventBasePtr &event) {
|
2010-11-28 01:13:45 +01:00
|
|
|
if (event->mEventType == EventChangeViewState) {
|
2010-09-11 02:28:50 +02:00
|
|
|
IMGUIClear();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-04-05 23:38:59 +02:00
|
|
|
}
|