From 7b95e3a9eacf296f215c73e5d8ad9090a24adb20 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Thu, 4 Jan 2018 21:36:30 +0000 Subject: [Engine] Now using stb_image to laod all kinds of textures. --- examples/shooter/player.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'examples/shooter/player.cpp') diff --git a/examples/shooter/player.cpp b/examples/shooter/player.cpp index b2b85cfd..dab743a9 100644 --- a/examples/shooter/player.cpp +++ b/examples/shooter/player.cpp @@ -10,7 +10,7 @@ void Player::setTexture(const yage::Texture &texture) { texture_ = texture; } -void Player::draw(yage::SpriteBatch &sp) const +void Player::draw(yage::SpriteBatch &sp) { static int time = 0; static int iteration = 0; @@ -21,7 +21,7 @@ void Player::draw(yage::SpriteBatch &sp) const case Action::IDLE: sp.draw(bound_, {width, static_cast(direction_) * height, width, height}, - texture_.id, yage::Colour(255, 255, 255, 255), 0); + texture_.id, yage::Colour(255, 255, 255, 255), 1); break; case Action::MOVING: if(time % 15 == 0) { @@ -29,7 +29,7 @@ void Player::draw(yage::SpriteBatch &sp) const } sp.draw(bound_, {iteration * 2 * width, static_cast(direction_) * height, width, height}, - texture_.id, yage::Colour(255, 255, 255, 255), 0); + texture_.id, yage::Colour(255, 255, 255, 255), 1); time = (time + 1) % 59; break; } @@ -61,6 +61,11 @@ void Player::idle() action_ = Action::IDLE; } +void Player::look(Direction direction) +{ + direction_ = direction; +} + glm::vec4 Player::position() const { return bound_; -- cgit