Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Capp.h"
- void CApp::OnEvent(SDL_Event *event)
- {
- MyEvents::OnEvent(event);
- if(event->type == SDL_QUIT)
- {
- Running = false;
- }
- }
- void CApp::OnExit()
- {
- Running = false;
- }
- void CApp::OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode)
- {
- if(sym == SDLK_ESCAPE)
- OnExit();
- if(sym == SDLK_RIGHT)
- {
- MainCharacter.ReceiveEvent(EVENT_WALK, 0);
- }
- else if(sym == SDLK_LEFT)
- {
- MainCharacter.ReceiveEvent(EVENT_WALK, 1);
- }
- }
- void CApp:: OnKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode)
- {
- if(sym == SDLK_RIGHT)
- {
- MainCharacter.ReceiveEvent(EVENT_STOP, 0);
- }
- else if(sym == SDLK_LEFT)
- {
- MainCharacter.ReceiveEvent(EVENT_STOP, 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement