A 2D tile-based sandbox game.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

common.h 572B

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #include <SFML/Graphics.hpp>
  3. #include <SFML/System/Vector2.hpp>
  4. #include "Vector2.h"
  5. namespace Swan {
  6. static constexpr float TILE_SIZE = 32;
  7. static constexpr int TICK_RATE = 20;
  8. static constexpr int CHUNK_HEIGHT = 32;
  9. static constexpr int CHUNK_WIDTH = 32;
  10. struct Win {
  11. public:
  12. sf::RenderWindow *window_;
  13. sf::Transform transform_;
  14. Win(sf::RenderWindow *win): window_(win) {}
  15. void setPos(const Vec2 &pos) {
  16. transform_ = sf::Transform().translate(pos);
  17. }
  18. void draw(const sf::Drawable &drawable) {
  19. window_->draw(drawable, transform_);
  20. }
  21. };
  22. }