SDOM - Simple SDL Document Object Model
A lightweight, extensible Document Object Model for SDL-based applications.
Loading...
Searching...
No Matches
SDOM_Frame.hpp
Go to the documentation of this file.
1// SDOM_Frame.hpp
2#pragma once
3
5
6namespace SDOM
7{
8
9 class Frame : public IPanelObject
10 {
12
13 public:
14 // --- Type Info --- //
15 static constexpr const char* TypeName = "Frame";
16
17 // --- Initialization Struct --- //
19 {
21 {
22 // from IDisplayObject
23 name = TypeName;
24 type = TypeName;
25 color = {96, 0, 96, 255}; // panel color
26 isClickable = false;
27 tabEnabled = false;
28 // from IPanelObject
30 icon_resource = "internal_icon_8x8"; // Default to internal 8x8 sprite sheet
31 icon_width = 8; // default icon width is 8
32 icon_height = 8; // default icon height is 8
33 font_resource = "internal_font_8x8"; // Default to internal 8x8 font
34 font_width = 8; // default font width is 8
35 font_height = 8; // default font height is 8
36 }
37 // no additional members from Frame
38 }; // END: InitStruct
39 protected:
40 // --- Constructors --- //
41 Frame(const InitStruct& init);
42 Frame(const sol::table& config);
43
44 public:
45
46 // --- Static Factory Methods --- //
47 static std::unique_ptr<IDisplayObject> CreateFromLua(const sol::table& config) {
48 return std::unique_ptr<IDisplayObject>(new Frame(config));
49 }
50 static std::unique_ptr<IDisplayObject> CreateFromInitStruct(const IDisplayObject::InitStruct& baseInit) {
51 const auto& frameInit = static_cast<const Frame::InitStruct&>(baseInit);
52 return std::unique_ptr<IDisplayObject>(new Frame(frameInit));
53 }
54
55 Frame() = default;
56 virtual ~Frame() = default;
57
58 // --- Virtual Methods --- //
59 virtual bool onInit() override; // Called when the display object is initialized
60 virtual void onRender() override; // Called to render the display object
61 virtual void onQuit() override; // Called when the display object is being destroyed
62 virtual void onUpdate(float fElapsedTime) override; // Called every frame to update the display object
63 virtual void onEvent(const Event& event) override; // Called when an event occurs
64
65 protected:
66
67 // --- Lua Registration --- //
68 virtual void _registerLuaBindings(const std::string& typeName, sol::state_view lua);
69
70 }; // END: class Frame : public IPanelObject
71
72} // END namespace SDOM
Definition SDOM_Event.hpp:55
Definition SDOM_Frame.hpp:10
static std::unique_ptr< IDisplayObject > CreateFromLua(const sol::table &config)
Definition SDOM_Frame.hpp:47
Frame()=default
virtual void _registerLuaBindings(const std::string &typeName, sol::state_view lua)
Definition SDOM_Frame.cpp:74
static constexpr const char * TypeName
Definition SDOM_Frame.hpp:15
virtual bool onInit() override
Definition SDOM_Frame.cpp:41
virtual void onEvent(const Event &event) override
Definition SDOM_Frame.cpp:66
virtual void onUpdate(float fElapsedTime) override
Definition SDOM_Frame.cpp:59
static std::unique_ptr< IDisplayObject > CreateFromInitStruct(const IDisplayObject::InitStruct &baseInit)
Definition SDOM_Frame.hpp:50
virtual void onRender() override
Definition SDOM_Frame.cpp:53
virtual void onQuit() override
Definition SDOM_Frame.cpp:47
virtual ~Frame()=default
Definition SDOM_IPanelObject.hpp:107
Contains all core classes and utilities for the SDOM library.
Definition lua_BindHelpers.hpp:7
Definition SDOM_Frame.hpp:19
InitStruct()
Definition SDOM_Frame.hpp:20
Definition SDOM_IDisplayObject.hpp:187
std::string type
Definition SDOM_IDisplayObject.hpp:189
bool tabEnabled
Definition SDOM_IDisplayObject.hpp:212
std::string name
Definition SDOM_IDisplayObject.hpp:188
SDL_Color color
Definition SDOM_IDisplayObject.hpp:194
bool isClickable
Definition SDOM_IDisplayObject.hpp:208
Definition SDOM_IPanelObject.hpp:116
std::string font_resource
Definition SDOM_IPanelObject.hpp:127
std::string icon_resource
Definition SDOM_IPanelObject.hpp:124
int font_height
Definition SDOM_IPanelObject.hpp:129
PanelBaseIndex base_index
Definition SDOM_IPanelObject.hpp:123
int font_width
Definition SDOM_IPanelObject.hpp:128
int icon_height
Definition SDOM_IPanelObject.hpp:126
int icon_width
Definition SDOM_IPanelObject.hpp:125