BoxCollider.h 885 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * 2D Game Engine
  3. * BoxCollider.h:
  4. * Based on pikuma.com 2D game engine in C++ and Lua course
  5. * Copyright (c) 2021 986-Studio. All rights reserved.
  6. *
  7. * Created by Manoël Trapier on 15/02/2021.
  8. */
  9. #ifndef GAMEENGINE_BOXCOLLIDER_H
  10. #define GAMEENGINE_BOXCOLLIDER_H
  11. #include <stdint.h>
  12. #include <vector>
  13. #include <glm/glm.hpp>
  14. struct BoxColliderComponent
  15. {
  16. uint32_t width;
  17. uint32_t height;
  18. glm::vec2 offset;
  19. bool isColliding;
  20. std::vector<Entity>collidingList;
  21. explicit BoxColliderComponent(uint32_t width = 0, uint32_t height= 0,
  22. glm::vec2 offset = glm::vec2(0, 0)):width(width), height(height),
  23. offset(offset)
  24. {
  25. this->isColliding = false;
  26. this->collidingList.clear();
  27. };
  28. };
  29. #endif /* GAMEENGINE_BOXCOLLIDER_H */