A 2D tile-based sandbox game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Body.h 398B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <SFML/Graphics.hpp>
  3. #include "common.h"
  4. namespace Swan {
  5. class Body {
  6. public:
  7. Vec2 force_ = { 0, 0 };
  8. Vec2 vel_ = { 0, 0 };
  9. Vec2 pos_;
  10. Vec2 size_;
  11. float mass_;
  12. Body(Vec2 pos, Vec2 size, float mass):
  13. pos_(pos), size_(size), mass_(mass) {};
  14. void friction(float coef);
  15. void gravity(Vec2 g = Vec2(0, 9.81));
  16. void outline(Win &win);
  17. void update(float dt);
  18. };
  19. }