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.

EntItemStack.h 762B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include <swan/swan.h>
  3. class EntItemStack: public Swan::Entity {
  4. public:
  5. class Factory: public Swan::Entity::Factory {
  6. Swan::Entity *create(const Swan::Context &ctx, const Swan::SRF &params) override {
  7. return new EntItemStack(ctx, params);
  8. }
  9. };
  10. EntItemStack(const Swan::Context &ctx, const Swan::SRF &params);
  11. void draw(const Swan::Context &ctx, Swan::Win &win) override;
  12. void update(const Swan::Context &ctx, float dt) override;
  13. void readSRF(const Swan::Context &ctx, const Swan::SRF &srf) override;
  14. Swan::SRF *writeSRF(const Swan::Context &ctx) override;
  15. private:
  16. static constexpr float MASS = 80;
  17. static constexpr Swan::Vec2 SIZE = Swan::Vec2(0.5, 0.5);
  18. Swan::Item *item_ = &Swan::Item::INVALID_ITEM;
  19. Swan::Body body_;
  20. };