Shkyera Engine
Easy to use, game engine for Python
shkyera::UI Class Reference

A class responsible for managing the user interface (UI) of the application. More...

#include <UI.hpp>

Public Member Functions

 UI (std::shared_ptr< Game > game)
 Constructor to create a UI manager for the specified game. More...
 
void initialize ()
 Initialize the UI, including ImGui, widgets, and assets. More...
 
void draw ()
 Render the UI. More...
 
void close ()
 Close and clean up the UI. More...
 
bool shouldClose () const
 Check if the UI should be closed. More...
 

Static Public Attributes

static ImFont * NORMAL_FONT = nullptr
 The normal font used in the UI. More...
 
static ImFont * BIG_FONT = nullptr
 A larger font used in the UI. More...
 
static ImFont * HUGE_FONT = nullptr
 An even larger font used in the UI. More...
 
static ImFont * SMALL_FONT = nullptr
 A smaller font used in the UI. More...
 
static ImVec4 BACKGROUND_COLOR = ImVec4(0.17f, 0.17f, 0.17f, 1.0f)
 Background color. More...
 
static ImVec4 TEXT_COLOR = ImVec4(0.86f, 0.86f, 0.86f, 1.0f)
 Text color. More...
 
static ImVec4 DISABLED_TEXT_COLOR = ImVec4(0.86f, 0.93f, 0.89f, 0.28f)
 Disabled text color. More...
 
static ImVec4 ACCENT_COLOR = ImVec4(0.4f, 0.05f, 0.7f, 1.0f)
 Accent color. More...
 
static ImVec4 STRONG_ACCENT_COLOR = ImVec4(0.5f, 0.06f, 0.82f, 1.0f)
 Strong accent color. More...
 
static ImVec4 GREY = ImVec4(0.3f, 0.3f, 0.3f, 1.0f)
 Grey color. More...
 
static ImVec4 LIGHT_GREY = ImVec4(0.8f, 0.8f, 0.8f, 1.0f)
 Light grey color. More...
 
static ImVec4 DARK_ACCENT = ImVec4(0.1f, 0.1f, 0.1f, 1.0f)
 Dark accent color. More...
 
static ImVec4 BLACK = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
 Black color. More...
 

Private Member Functions

void initializeImgui ()
 Initialize ImGui and other UI elements. More...
 
void initializeWidgets ()
 Initialize UI widgets. More...
 
void initializeAssets ()
 Initialize UI assets. More...
 
void initializeInterpreter ()
 Initialize the Python interpreter. More...
 
void styleImgui ()
 Apply styling to ImGui elements. More...
 
void beginFrame ()
 Begin a UI frame. More...
 
void renderFrame ()
 Render the UI frame. More...
 
void endFrame ()
 End the UI frame. More...
 

Private Attributes

std::shared_ptr< Game_game
 A shared pointer to the associated game. More...
 
std::shared_ptr< Renderer_renderer
 A shared pointer to the renderer. More...
 
bool _open
 Flag indicating if the UI is open. More...
 
GLFWwindow * _window
 The UI window. More...
 
std::vector< std::unique_ptr< Widget > > _widgets
 A collection of UI widgets. More...
 

Detailed Description

A class responsible for managing the user interface (UI) of the application.

The UI class is responsible for initializing and rendering the UI elements, including widgets, using ImGui.

Constructor & Destructor Documentation

◆ UI()

shkyera::UI::UI ( std::shared_ptr< Game game)

Constructor to create a UI manager for the specified game.

Parameters
gameA shared pointer to the game to associate with the UI.

Member Function Documentation

◆ beginFrame()

void shkyera::UI::beginFrame ( )
private

Begin a UI frame.

◆ close()

void shkyera::UI::close ( )

Close and clean up the UI.

◆ draw()

void shkyera::UI::draw ( )

Render the UI.

◆ endFrame()

void shkyera::UI::endFrame ( )
private

End the UI frame.

◆ initialize()

void shkyera::UI::initialize ( )

Initialize the UI, including ImGui, widgets, and assets.

◆ initializeAssets()

void shkyera::UI::initializeAssets ( )
private

Initialize UI assets.

◆ initializeImgui()

void shkyera::UI::initializeImgui ( )
private

Initialize ImGui and other UI elements.

◆ initializeInterpreter()

void shkyera::UI::initializeInterpreter ( )
private

Initialize the Python interpreter.

◆ initializeWidgets()

void shkyera::UI::initializeWidgets ( )
private

Initialize UI widgets.

◆ renderFrame()

void shkyera::UI::renderFrame ( )
private

Render the UI frame.

◆ shouldClose()

bool shkyera::UI::shouldClose ( ) const

Check if the UI should be closed.

Returns
True if the UI should be closed, false otherwise.

◆ styleImgui()

void shkyera::UI::styleImgui ( )
private

Apply styling to ImGui elements.

Member Data Documentation

◆ _game

std::shared_ptr<Game> shkyera::UI::_game
private

A shared pointer to the associated game.

◆ _open

bool shkyera::UI::_open
private

Flag indicating if the UI is open.

◆ _renderer

std::shared_ptr<Renderer> shkyera::UI::_renderer
private

A shared pointer to the renderer.

◆ _widgets

std::vector<std::unique_ptr<Widget> > shkyera::UI::_widgets
private

A collection of UI widgets.

◆ _window

GLFWwindow* shkyera::UI::_window
private

The UI window.

◆ ACCENT_COLOR

ImVec4 shkyera::UI::ACCENT_COLOR = ImVec4(0.4f, 0.05f, 0.7f, 1.0f)
inlinestatic

Accent color.

◆ BACKGROUND_COLOR

ImVec4 shkyera::UI::BACKGROUND_COLOR = ImVec4(0.17f, 0.17f, 0.17f, 1.0f)
inlinestatic

Background color.

◆ BIG_FONT

ImFont * shkyera::UI::BIG_FONT = nullptr
static

A larger font used in the UI.

◆ BLACK

ImVec4 shkyera::UI::BLACK = ImVec4(0.0f, 0.0f, 0.0f, 0.0f)
inlinestatic

Black color.

◆ DARK_ACCENT

ImVec4 shkyera::UI::DARK_ACCENT = ImVec4(0.1f, 0.1f, 0.1f, 1.0f)
inlinestatic

Dark accent color.

◆ DISABLED_TEXT_COLOR

ImVec4 shkyera::UI::DISABLED_TEXT_COLOR = ImVec4(0.86f, 0.93f, 0.89f, 0.28f)
inlinestatic

Disabled text color.

◆ GREY

ImVec4 shkyera::UI::GREY = ImVec4(0.3f, 0.3f, 0.3f, 1.0f)
inlinestatic

Grey color.

◆ HUGE_FONT

ImFont * shkyera::UI::HUGE_FONT = nullptr
static

An even larger font used in the UI.

◆ LIGHT_GREY

ImVec4 shkyera::UI::LIGHT_GREY = ImVec4(0.8f, 0.8f, 0.8f, 1.0f)
inlinestatic

Light grey color.

◆ NORMAL_FONT

ImFont * shkyera::UI::NORMAL_FONT = nullptr
static

The normal font used in the UI.

◆ SMALL_FONT

ImFont * shkyera::UI::SMALL_FONT = nullptr
static

A smaller font used in the UI.

◆ STRONG_ACCENT_COLOR

ImVec4 shkyera::UI::STRONG_ACCENT_COLOR = ImVec4(0.5f, 0.06f, 0.82f, 1.0f)
inlinestatic

Strong accent color.

◆ TEXT_COLOR

ImVec4 shkyera::UI::TEXT_COLOR = ImVec4(0.86f, 0.86f, 0.86f, 1.0f)
inlinestatic

Text color.


The documentation for this class was generated from the following files: