My Project
Loading...
Searching...
No Matches
Editor::Buttons Class Reference

Class responsible for handling editor UI buttons and interactions. Manages project creation/loading, GameObject manipulation, component management, script handling, audio control, and project saving inside the editor. More...

#include <Buttons.hpp>

Public Member Functions

 Buttons ()
 Default constructor.
 ~Buttons ()
 Destructor Clears pointers to the selected entity and component.
void init ()
 Initializes the editor buttons and UI states.
void update (AssetManager &manager)
 Updates editor button logic and interactions.
bool createProject ()
 Creates a new project.
void loadProject ()
 Loads an existing project.
void projectName ()
 Handles project name input and validation.
void showScriptMenu (ScriptManager &scriptM)
 Displays the script management menu.
void AddScript (ScriptManager &scriptM)
 Adds a new script.
void deleteScript (ScriptManager &scriptM)
 Deletes an existing script.
void editScript (ScriptManager &scriptM)
 Opens a script for editing.
void showScripts (ScriptManager &scriptM)
 Displays the list of available scripts.
bool CheckScriptNameValid (const std::string &str)
 Checks whether the script name is valid.
bool reloadScript ()
 Reloads editor scripts.
void selectGO (std::shared_ptr< Engine::Scene > &scene)
 Selects a GameObject from the scene.
void createGO (std::shared_ptr< Engine::Scene > &scene)
 Creates a new GameObject in the scene.
void delGO (std::shared_ptr< Engine::Scene > &scene)
 Deletes the selected GameObject from the scene.
void ChangeGOName ()
 Changes the name of the selected GameObject.
bool CheckGoNameValid (const std::string &str)
 Checks whether the GameObject name is valid.
bool CheckCaraterValid (const std::string &str)
 Checks whether the characters used in a name are valid.
void showCmpnt (const AssetManager &assetM)
 Displays all components attached to the selected GameObject.
void addComponent ()
 Adds a component to the selected GameObject.
void delComponent ()
 Deletes a component from the selected GameObject.
void editComponent (const AssetManager &assetM)
 Edits the selected component values.
void loadSound (Engine::MiniAudioSystem sound)
 Loads a sound file into the audio system.
void playSound (Engine::MiniAudioSystem sound)
 Plays a loaded sound.
void stopPlayingSound (Engine::MiniAudioSystem sound)
 Stops the currently playing sound.
void Guizmo ()
 Handles editor gizmo manipulation (translate/rotate/scale).
bool saveProject ()
 Saves the current project.
bool startRuntime ()
 Starts the runtime mode of the editor.
void loadAssets (AssetManager &manager)
 Loads project assets.
std::string GetSessionName () const
 Returns the current session name.
std::string GetSessionNameStatus () const
 Returns the session status message.
bool GetLoadProject () const
 Indicates whether the project load dialog is active.
std::string GetProjectPath () const
 Returns the current project path.
bool GetLoadProjReady () const
 Indicates if the project is ready to be loaded.
bool GetLoadAsset () const
 Indicates if asset loading is requested.
std::string GetScriptName () const
 Returns the current script name.
void SetSessionName (std::string session)
 Sets the session name.
void SetSessionNameStatus (std::string txt)
 Sets the session status message.
void SetLoadSession (bool activated)
 Enables or disables the load session dialog.
void SetProjectPath (std::string path)
 Sets the project path.
void SetLoadProjReady (bool ready)
 Sets the project ready state.
void SetLoadAsset (bool load)
 Enables or disables asset loading.
void SetScriptName (std::string name)
 Sets the script name.
void SetSelectedEntity ()
 Clears the selected entity.

Protected Attributes

Engine::GameObjectselectedEntity = nullptr
 Pointer to the currently selected GameObject.
std::string currentEntityLabel
 Label of the currently selected GameObject.
std::string selectedScript
 Name of the currently selected script.
std::string scriptName = "Null"
 Name of the script being created or edited.
Engine::ComponentselectedComponent = nullptr
 Pointer to the currently selected component.

Detailed Description

Class responsible for handling editor UI buttons and interactions. Manages project creation/loading, GameObject manipulation, component management, script handling, audio control, and project saving inside the editor.

Constructor & Destructor Documentation

◆ Buttons()

Editor::Buttons::Buttons ( )
inline

Default constructor.

◆ ~Buttons()

Editor::Buttons::~Buttons ( )
inline

Destructor Clears pointers to the selected entity and component.

Member Function Documentation

◆ addComponent()

void Editor::Buttons::addComponent ( )

Adds a component to the selected GameObject.

◆ AddScript()

void Editor::Buttons::AddScript ( ScriptManager & scriptM)

Adds a new script.

Parameters
scriptMScript manager

◆ ChangeGOName()

void Editor::Buttons::ChangeGOName ( )

Changes the name of the selected GameObject.

◆ CheckCaraterValid()

bool Editor::Buttons::CheckCaraterValid ( const std::string & str)

Checks whether the characters used in a name are valid.

Parameters
strString to validate
Returns
True if characters are valid

◆ CheckGoNameValid()

bool Editor::Buttons::CheckGoNameValid ( const std::string & str)

Checks whether the GameObject name is valid.

Parameters
strName to validate
Returns
True if the name is not composed only of spaces

◆ CheckScriptNameValid()

bool Editor::Buttons::CheckScriptNameValid ( const std::string & str)

Checks whether the script name is valid.

Parameters
strScript name to validate
Returns
True if the script name is valid

◆ createGO()

void Editor::Buttons::createGO ( std::shared_ptr< Engine::Scene > & scene)

Creates a new GameObject in the scene.

Parameters
sceneActive scene

◆ createProject()

bool Editor::Buttons::createProject ( )

Creates a new project.

Returns
True if the project was successfully created

◆ delComponent()

void Editor::Buttons::delComponent ( )

Deletes a component from the selected GameObject.

◆ deleteScript()

void Editor::Buttons::deleteScript ( ScriptManager & scriptM)

Deletes an existing script.

Parameters
scriptMScript manager

◆ delGO()

void Editor::Buttons::delGO ( std::shared_ptr< Engine::Scene > & scene)

Deletes the selected GameObject from the scene.

Parameters
sceneActive scene

◆ editComponent()

void Editor::Buttons::editComponent ( const AssetManager & assetM)

Edits the selected component values.

Parameters
assetMAsset manager

◆ editScript()

void Editor::Buttons::editScript ( ScriptManager & scriptM)

Opens a script for editing.

Parameters
scriptMScript manager

◆ GetLoadAsset()

bool Editor::Buttons::GetLoadAsset ( ) const
inline

Indicates if asset loading is requested.

Returns
True if assets should be loaded

◆ GetLoadProject()

bool Editor::Buttons::GetLoadProject ( ) const
inline

Indicates whether the project load dialog is active.

Returns
True if active

◆ GetLoadProjReady()

bool Editor::Buttons::GetLoadProjReady ( ) const
inline

Indicates if the project is ready to be loaded.

Returns
True if ready

◆ GetProjectPath()

std::string Editor::Buttons::GetProjectPath ( ) const
inline

Returns the current project path.

Returns
Project path

◆ GetScriptName()

std::string Editor::Buttons::GetScriptName ( ) const
inline

Returns the current script name.

Returns
Script name

◆ GetSessionName()

std::string Editor::Buttons::GetSessionName ( ) const
inline

Returns the current session name.

Returns
Session name

◆ GetSessionNameStatus()

std::string Editor::Buttons::GetSessionNameStatus ( ) const
inline

Returns the session status message.

Returns
Status message

◆ Guizmo()

void Editor::Buttons::Guizmo ( )

Handles editor gizmo manipulation (translate/rotate/scale).

◆ init()

void Editor::Buttons::init ( )

Initializes the editor buttons and UI states.

◆ loadAssets()

void Editor::Buttons::loadAssets ( AssetManager & manager)

Loads project assets.

Parameters
managerAsset manager

◆ loadProject()

void Editor::Buttons::loadProject ( )

Loads an existing project.

◆ loadSound()

void Editor::Buttons::loadSound ( Engine::MiniAudioSystem sound)

Loads a sound file into the audio system.

Parameters
soundMiniAudio sound system

◆ playSound()

void Editor::Buttons::playSound ( Engine::MiniAudioSystem sound)

Plays a loaded sound.

Parameters
soundMiniAudio sound system

◆ projectName()

void Editor::Buttons::projectName ( )

Handles project name input and validation.

◆ reloadScript()

bool Editor::Buttons::reloadScript ( )

Reloads editor scripts.

Returns
True if the reload succeeded

◆ saveProject()

bool Editor::Buttons::saveProject ( )

Saves the current project.

Returns
True if the project was successfully saved

◆ selectGO()

void Editor::Buttons::selectGO ( std::shared_ptr< Engine::Scene > & scene)

Selects a GameObject from the scene.

Parameters
sceneActive scene

◆ SetLoadAsset()

void Editor::Buttons::SetLoadAsset ( bool load)
inline

Enables or disables asset loading.

◆ SetLoadProjReady()

void Editor::Buttons::SetLoadProjReady ( bool ready)
inline

Sets the project ready state.

◆ SetLoadSession()

void Editor::Buttons::SetLoadSession ( bool activated)
inline

Enables or disables the load session dialog.

◆ SetProjectPath()

void Editor::Buttons::SetProjectPath ( std::string path)
inline

Sets the project path.

◆ SetScriptName()

void Editor::Buttons::SetScriptName ( std::string name)
inline

Sets the script name.

◆ SetSelectedEntity()

void Editor::Buttons::SetSelectedEntity ( )
inline

Clears the selected entity.

◆ SetSessionName()

void Editor::Buttons::SetSessionName ( std::string session)
inline

Sets the session name.

◆ SetSessionNameStatus()

void Editor::Buttons::SetSessionNameStatus ( std::string txt)
inline

Sets the session status message.

◆ showCmpnt()

void Editor::Buttons::showCmpnt ( const AssetManager & assetM)

Displays all components attached to the selected GameObject.

Parameters
assetMAsset manager

◆ showScriptMenu()

void Editor::Buttons::showScriptMenu ( ScriptManager & scriptM)

Displays the script management menu.

Parameters
scriptMScript manager

◆ showScripts()

void Editor::Buttons::showScripts ( ScriptManager & scriptM)

Displays the list of available scripts.

Parameters
scriptMScript manager

◆ startRuntime()

bool Editor::Buttons::startRuntime ( )

Starts the runtime mode of the editor.

Returns
True if runtime started successfully

◆ stopPlayingSound()

void Editor::Buttons::stopPlayingSound ( Engine::MiniAudioSystem sound)

Stops the currently playing sound.

Parameters
soundMiniAudio sound system

◆ update()

void Editor::Buttons::update ( AssetManager & manager)

Updates editor button logic and interactions.

Parameters
managerAsset manager used by the editor

Member Data Documentation

◆ currentEntityLabel

std::string Editor::Buttons::currentEntityLabel
protected

Label of the currently selected GameObject.

◆ scriptName

std::string Editor::Buttons::scriptName = "Null"
protected

Name of the script being created or edited.

◆ selectedComponent

Engine::Component* Editor::Buttons::selectedComponent = nullptr
protected

Pointer to the currently selected component.

◆ selectedEntity

Engine::GameObject* Editor::Buttons::selectedEntity = nullptr
protected

Pointer to the currently selected GameObject.

◆ selectedScript

std::string Editor::Buttons::selectedScript
protected

Name of the currently selected script.


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