A small game engine for 2D games based of Raylib
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

27 rindas
985 B

  1. #pragma once
  2. #include "component.h"
  3. #include <string>
  4. #include "raylib.h"
  5. #include "transform.h"
  6. namespace ant::components::ui {
  7. struct panel_component : public ant::core::component {
  8. panel_component() {}
  9. panel_component(
  10. int layer = 0,
  11. Color color = BLUE,
  12. ant::core::Vec2<> size = {100,100},
  13. ant::core::Vec2<> scale = {1,1}
  14. );
  15. std::string name() override {return "panel_component";}
  16. void initialize() override;
  17. void render() override;
  18. void update(std::chrono::duration<double>) override;
  19. ant::core::Vec2<> scale();
  20. private:
  21. ant::core::Vec2<> m_size;
  22. ant::core::Vec2<> m_scale;
  23. int m_layer; //< This is ignored if a parent panel is found, panels bleed up to one layer below their current layer
  24. Color m_color;
  25. std::weak_ptr<panel_component> m_parent_panel = std::shared_ptr<panel_component>(nullptr);
  26. };
  27. }