Shkyera Engine
Easy to use, game engine for Python
SceneWidget.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "renderer/Renderer.hpp"
10 #include "ui/Widget.hpp"
11 
12 namespace shkyera {
13 
20 class SceneWidget : public Widget {
21  public:
22  using Widget::Widget;
23 
27  virtual void draw() override;
28 
32  void adjustSize();
33 
39  void setRenderer(std::shared_ptr<Renderer> renderer);
40 
41  private:
45  void drawRuntime() const;
46 
50  void drawScene();
51 
55  void readInput() const;
56 
57  std::shared_ptr<Renderer> _renderer;
58  ImVec2 _renderSize;
59 };
60 
61 } // namespace shkyera
Contains the declaration of the Widget class, an abstract base class for GUI widgets.
A user interface widget for rendering scenes.
Definition: SceneWidget.hpp:20
virtual void draw() override
Implementation of the abstract draw method to render the scene widget.
Definition: SceneWidget.cpp:19
void readInput() const
Read the user input from the keyboard and notify the Python intepreter of it.
Definition: SceneWidget.cpp:72
void drawRuntime() const
Draw the runtime rendered scene.
Definition: SceneWidget.cpp:41
std::shared_ptr< Renderer > _renderer
A shared pointer to the renderer used for scene rendering.
Definition: SceneWidget.hpp:57
void adjustSize()
Adjust the size of the scene widget.
Definition: SceneWidget.cpp:33
ImVec2 _renderSize
The size of the rendered scene area.
Definition: SceneWidget.hpp:58
void drawScene()
Draw the empty scene when it is not running.
Definition: SceneWidget.cpp:59
void setRenderer(std::shared_ptr< Renderer > renderer)
Set the renderer to use for rendering the scene.
Definition: SceneWidget.cpp:14
An abstract base class representing a GUI widget.
Definition: Widget.hpp:21
Widget(std::string name)
Constructor to create a widget with a specified name.
Definition: Widget.cpp:5
Definition: Entity.cpp:3