Advertisement
Guest User

block

a guest
Apr 25th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #ifndef block_h
  2. #define block_h
  3. #include <SFML/Graphics.hpp>
  4.  
  5. class Block
  6. {
  7. public:
  8.     void init(int x, int y);
  9.     void update(sf::Sprite s);
  10.     int x();
  11.     int y();
  12. private:
  13.     int posX;
  14.     int posY;
  15.  
  16. };
  17.  
  18. #endif // block_h
  19.  
  20. góra .h dół .cpp
  21.  
  22. #include "block.h"
  23. #include "levels.h"
  24. #include <SFML/Graphics.hpp>
  25.  
  26. int Block::x()
  27. {
  28.     return posX;
  29. }
  30. int Block::y()
  31. {
  32.     return posY;
  33. }
  34. void Block::init(int x, int y)
  35. {
  36.     posX = x;
  37.     posY = y;
  38.  
  39.  
  40. }
  41. void Block::update(sf::Sprite s)
  42. {
  43.     s.setPosition(sf::Vector2f(posX, posY));
  44.     sfokno.draw(s);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement