Browse Source

implement setPosition for Player

master
noerw 2 years ago
parent
commit
3352e57d46
2 changed files with 16 additions and 9 deletions
  1. +12
    -7
      player.cpp
  2. +4
    -2
      player.hpp

+ 12
- 7
player.cpp View File

@@ -1,12 +1,17 @@
#include "player.hpp"

namespace Proto4 {
Player::Player() {
triangle = sf::CircleShape(80,3);
triangle.setFillColor(sf::Color(100, 250, 50));
}
Player::Player() {
triangle = sf::CircleShape(50, 3);
triangle.setFillColor(sf::Color(50, 150, 150));
triangle.setOrigin(50, 50);
}

void Player::draw(sf::RenderTarget &window, sf::RenderStates states) const {
window.draw(triangle);
}

void Player::draw(sf::RenderTarget &window, sf::RenderStates states) const {
window.draw(triangle);
void Player::setPosition(sf::Vector2f pos) {
triangle.setPosition(pos);
}
}
}

+ 4
- 2
player.hpp View File

@@ -10,8 +10,10 @@ namespace Proto4 {
sf::CircleShape triangle;

public:
Player();
Player();
virtual void draw(sf::RenderTarget &window,
sf::RenderStates states) const;

virtual void setPosition(sf::Vector2f pos);
};
}
}

Loading…
Cancel
Save