Player::Player(TileMapLand* land) : Entity() , hitEnemy(false) , m_sprite_view(new AnimatedSpriteView(*this,"Animation/player.txt")) , m_plateforme_physics(new PlateformerPhysic(*this,land)) { name = "Player"; setBody(new Body(*this)); body()->setSize(sf::Vector2f(16,16)); body()->setOrigin(sf::Vector2f(8,8)); body()->setPosition(sf::Vector2f(38,38)); setPhysics(m_plateforme_physics); m_plateforme_physics->gravity = sf::Vector2f(0,0.3); m_plateforme_physics->max_speed = sf::Vector2f(2.0,8.0); m_plateforme_physics->jump_power = 8.0; m_plateforme_physics->walk_speed = 2.0; m_plateforme_physics->run_speed = 3.0; m_plateforme_physics->walk_deceleration = 0.3; setGamepad(new KeyBoardGamePad(*this)); setView(m_sprite_view); }
void ofxGamepadCamera::setup() { //CHECK IF THERE IS A GAMEPAD CONNECTED if(ofxGamepadHandler::get()->getNumPads()>0) { setGamepad(ofxGamepadHandler::get()->getGamepad(0)); } else ofLogWarning("no gamepad connected in ofxGamepadCAmera::setup"); ofAddListener(ofEvents.update, this, &ofxGamepadCamera::update); }