OpenGTA/localplayer.cpp
Anonymous Maarten 1ae34ae340 2007-06-14
2015-12-03 01:38:22 +01:00

70 lines
1.4 KiB
C++

#include "localplayer.h"
#include "spritemanager.h"
namespace OpenGTA {
Pedestrian & PlayerController::getPed() {
return SpriteManagerHolder::Instance().getPed(playerId);
}
bool PlayerController::up(const uint32_t & key) {
if (!pc_ptr)
return false;
bool handled = false;
switch (key) {
case SDLK_LEFT:
pc_ptr->releaseTurnLeft();
handled = true;
break;
case SDLK_RIGHT:
pc_ptr->releaseTurnRight();
handled = true;
break;
case SDLK_UP:
pc_ptr->releaseMoveForward();
handled = true;
break;
case SDLK_DOWN:
pc_ptr->releaseMoveBack();
handled = true;
break;
case SDLK_LCTRL:
pc_ptr->releaseFireWeapon();
handled = true;
break;
default:
break;
}
return handled;
}
bool PlayerController::down(const uint32_t & key) {
if (!pc_ptr)
return false;
bool handled = false;
switch(key) {
case SDLK_LEFT:
handled = true;
break;
case SDLK_RIGHT:
handled = true;
break;
case SDLK_UP:
handled = true;
break;
case SDLK_DOWN:
handled = true;
break;
case SDLK_LCTRL:
handled = true;
break;
case SDLK_LSHIFT:
handled = true;
break;
default:
break;
}
return handled;
}
}