Shkyera Engine
Easy to use, game engine for Python
ScriptUIComponent.hpp
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <filesystem>
11 
13 #include "ui/UIComponent.hpp"
14 
15 namespace shkyera {
16 
25 
29  virtual void draw() override;
30 
31  private:
35  static constexpr float LABEL_MARGIN = 120.0f;
36 
42  void replaceScript(std::filesystem::path path);
43 
47  void drawScriptFile();
48 
52  void drawVariables();
53 
59  void drawFloatVariable(PublicFloat &variable);
60 
66  void drawIntVariable(PublicInt &variable);
67 
73  void drawStringVariable(PublicString &variable);
74 
80  void drawVec3Variable(PublicVec3 &variable);
81 
82  std::shared_ptr<ScriptComponent> _script;
83 };
84 
85 } // namespace shkyera
Contains the declaration of the ScriptComponent class and related data structures.
Contains the declaration of the UIComponent class, a base class for user interface of objects' compon...
A class representing a user interface component for interacting with scripts.
Definition: ScriptUIComponent.hpp:23
static constexpr float LABEL_MARGIN
The margin used for labeling elements in the UI.
Definition: ScriptUIComponent.hpp:35
void drawVariables()
Draw the script variables in the UI.
Definition: ScriptUIComponent.cpp:95
std::shared_ptr< ScriptComponent > _script
A shared pointer to the associated script component.
Definition: ScriptUIComponent.hpp:82
void drawIntVariable(PublicInt &variable)
Draw an integer variable in the UI.
Definition: ScriptUIComponent.cpp:129
virtual void draw() override
Implementation of the abstract draw method to render the UI for this component.
Definition: ScriptUIComponent.cpp:15
void drawScriptFile()
Draw the script file and its contents in the UI.
Definition: ScriptUIComponent.cpp:55
void drawFloatVariable(PublicFloat &variable)
Draw a float variable in the UI.
Definition: ScriptUIComponent.cpp:121
void drawVec3Variable(PublicVec3 &variable)
Draw a glm::vec3 variable in the UI.
Definition: ScriptUIComponent.cpp:149
void replaceScript(std::filesystem::path path)
Replace the current script with a new one from the specified file path.
Definition: ScriptUIComponent.cpp:35
void drawStringVariable(PublicString &variable)
Draw a string variable in the UI.
Definition: ScriptUIComponent.cpp:137
A base class representing a user interface (UI) for a game object's component.
Definition: UIComponent.hpp:21
UIComponent(std::string name, std::shared_ptr< GameObject > object)
Constructor to create a UI component with a specified name and associated game object.
Definition: UIComponent.cpp:6
Definition: Entity.cpp:3
Structure to represent a public float variable for use in scripts.
Definition: ScriptComponent.hpp:17
Structure to represent a public integer variable for use in scripts.
Definition: ScriptComponent.hpp:25
Structure to represent a public string variable for use in scripts.
Definition: ScriptComponent.hpp:33
Structure to represent a public glm::vec3 variable for use in scripts.
Definition: ScriptComponent.hpp:41