diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-04 21:36:30 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-01-04 21:36:30 +0000 |
commit | 7b95e3a9eacf296f215c73e5d8ad9090a24adb20 (patch) | |
tree | 77125b5b30e08e48903e802ad4cdfddbb03074c1 /examples/shooter/player.cpp | |
parent | a47649786fb94684c415b230669fbf5343cb7c5d (diff) | |
download | YAGE-7b95e3a9eacf296f215c73e5d8ad9090a24adb20.tar.gz YAGE-7b95e3a9eacf296f215c73e5d8ad9090a24adb20.zip |
[Engine] Now using stb_image to laod all kinds of textures.
Diffstat (limited to 'examples/shooter/player.cpp')
-rw-r--r-- | examples/shooter/player.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
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<int>(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<int>(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_; |