VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
vex::ProjectSelector Class Reference

Specialized Engine class for the initial project selection screen. More...

#include <ProjectSelector.hpp>

Inheritance diagram for vex::ProjectSelector:
vex::Engine

Public Member Functions

 ProjectSelector (const char *title)
 Constructs the ProjectSelector window.
void render () override
 Overrides the base render function to draw the project selection UI.
std::string getSelectedProject () const
 Gets the path of the project selected by the user.
Public Member Functions inherited from vex::Engine
 Engine (const char *title, int width, int height, GameInfo gInfo)
 Constructor for the Engine class.
virtual bool IsEditor ()
 Returns true if the engine is running in editor mode.
void run (std::function< void()> onUpdateLoop=nullptr)
 Starts and runs the main game loop.
vex::Entity getCamera ()
 Function returning the entity of the camera.
void setResolutionMode (ResolutionMode mode)
 Sets the resolution mode and updates the resolution manager.
void setPaused (bool paused)
 Internal function for handling pausing and resuming the game.
bool isPaused () const
 Function returning the current state of the game.
ResolutionMode getResolutionMode () const
 Returns the current resolution mode.
ResolutionManagergetResolutionManager () const
 returns a pointer to the resolution manager.
void setInputMode (InputMode mode)
 Function allowing for changing input mode at runtime.
InputMode getInputMode () const
 Returns the current input mode.
void setEnvironmentSettings (environment settings)
 Applies new global environment settings (lighting, shading) to the interface.
environment getEnvironmentSettings ()
 Returns the current environment settings.
InterfacegetInterface ()
 Returns Interface, used internally.
std::shared_ptr< VirtualFileSystemgetFileSystem ()
 Returns std::shared_ptr of VirtualFileSystem.
vex::RegistrygetRegistry ()
 Returns a reference to vex::Registry.
PhysicsSystemgetPhysicsSystem ()
 Returns pointer to PhysicsSystem.
SceneManagergetSceneManager ()
 Returns pointer to SceneManager.
std::shared_ptr< VexUIcreateVexUI ()
 Creates and returns a shared pointer to a VexUI instance.
int GetCurrentFrame ()
 Returns current frame number.
void setRenderPhysicsDebug (bool value)
 Function to enable/disable rendering collision shapes.
virtual void setFullscreen (bool enabled, bool exclusive=false)
 Function to enable/disable fullscreen mode. with optional exclusive parameter.
bool isFullscreen ()
 Function to check if fullscreen mode is enabled.
std::vector< std::string > getLastLoadedScenes ()
 Function to get the last loaded scenes.
void prepareScenesForHotReload ()
 Prepares the engine for a hot-reload event.
virtual void processEvent (const SDL_Event &event, float deltaTime)
 Internal virtual function for handling window/keyboard events.
virtual void beginGame ()
 Internal virtual function for handling stuff right at the beginning of the game but after initialization of the engine.
virtual void update (float deltaTime)
 Internal function for handling updates; called every frame before rendering.
virtual void refreshForObject ()
 Internal virtual function for editor.
void quit ()
 Simply sets m_running to false, Effectivelly soft shuting down the engine.
void WaitForGpu ()
 Waits for the GPU to finish all pending operations.
void setFrameLimit (int fps)
 Sets the target frame rate limit.
int getFrameLimit () const
void setVSync (bool enabled)
 Toggles VSync (Vertical Synchronization).
bool getVSync () const
 Returns the current state of VSync.
float getDeltaTime () const
 Returns the time since last frame.
std::shared_ptr< AudioSystemgetAudioSystem () const
 Returns the audio system.

Private Member Functions

void drawSelectorLayout (const SceneRenderData &data)
 Internal helper to draw the ImGUI layout for the project selector.
void loadKnownProjects ()
 Loads the list of recently known projects from the configuration file.
void saveKnownProjects ()
 Saves the current list of known projects to the configuration file.
void scanAndAddProject (const std::string &path)
 Scans a directory path for a valid VEX project file and adds it to the list.
void selectProject (const std::string &projectPath)
 Sets the path of the project that the user selected and triggers the closure of the selector.
void drawCreatorModal ()
 Draws the modal for creating a new project.
void drawAddExistingModal ()
 Draws the modal for adding an existing project.
void drawMoveProjectModal ()
 Draws the modal for moving an existing project.
void createNewProject ()
 Creates a new project with the given name and path.
void removeProject (int index)
 Removes a project from the list.
void moveProject (int index, const std::string &newParentDir)
 Moves a project to a new parent directory.
std::filesystem::path getUserDocumentsDir ()
 Gets the path to the user's documents directory.

Private Attributes

char m_newProjName [64] = "NewVexProject"
char m_newProjParentDir [512] = ""
char m_addExistingBuffer [512] = ""
char m_moveProjDestBuffer [512] = ""
int m_contextMenuTargetIndex = -1
std::vector< ProjectMetadatam_projects
std::string m_configPath = "recent_projects.json"
char m_inputBuffer [256] = ""
std::string m_selectedProjectPath = ""
bool shouldClose = false
uint8_t closeDelay = 5
bool m_showCreatorModal = false
bool m_showAddExistingModal = false
bool m_showMoveModal = false

Additional Inherited Members

Static Public Member Functions inherited from vex::Engine
static const char * GetBuildHash ()
 returns engine hash generated during build process.
static int GetVersionMajor ()
 Returns the major version of the engine.
static int GetVersionMinor ()
 Returns the minor version of the engine.
static int GetVersionPatch ()
 Returns the patch version of the engine.
static const char * GetVersionString ()
 Returns the version string of the engine.
Protected Member Functions inherited from vex::Engine
 Engine (SkipInit)
 Alternative constructor for editor to skip default init code.
Protected Attributes inherited from vex::Engine
std::shared_ptr< Windowm_window
std::shared_ptr< VirtualFileSystemm_vfs
std::shared_ptr< AudioSystemm_audioSystem
std::unique_ptr< Interfacem_interface
std::unique_ptr< ResolutionManagerm_resolutionManager
std::unique_ptr< ImGUIWrapperm_imgui
std::unique_ptr< InputSystemm_inputSystem
std::unique_ptr< PhysicsSystemm_physicsSystem
std::unique_ptr< SceneManagerm_sceneManager
vex::Registry m_registry
bool m_running = true
bool m_paused = false
bool m_internally_paused = false
bool m_renderPhysicsDebug = false
int m_frame = 0
int m_targetFps = 0
bool m_vsyncEnabled = false
float m_deltaTime = 0.016f
GameInfo m_gameInfo
std::vector< std::string > lastLoadedScenes

Detailed Description

Specialized Engine class for the initial project selection screen.

Definition at line 34 of file ProjectSelector.hpp.

Constructor & Destructor Documentation

◆ ProjectSelector()

vex::ProjectSelector::ProjectSelector ( const char * title)

Constructs the ProjectSelector window.

Parameters
constchar* title - The title of the window.

Definition at line 21 of file ProjectSelector.cpp.

Member Function Documentation

◆ createNewProject()

void vex::ProjectSelector::createNewProject ( )
private

Creates a new project with the given name and path.

Definition at line 380 of file ProjectSelector.cpp.

◆ drawAddExistingModal()

void vex::ProjectSelector::drawAddExistingModal ( )
private

Draws the modal for adding an existing project.

Definition at line 168 of file ProjectSelector.cpp.

◆ drawCreatorModal()

void vex::ProjectSelector::drawCreatorModal ( )
private

Draws the modal for creating a new project.

Definition at line 339 of file ProjectSelector.cpp.

◆ drawMoveProjectModal()

void vex::ProjectSelector::drawMoveProjectModal ( )
private

Draws the modal for moving an existing project.

Definition at line 198 of file ProjectSelector.cpp.

◆ drawSelectorLayout()

void vex::ProjectSelector::drawSelectorLayout ( const SceneRenderData & data)
private

Internal helper to draw the ImGUI layout for the project selector.

Parameters
constSceneRenderData& data - Data required for scene rendering (unused here).

Definition at line 79 of file ProjectSelector.cpp.

◆ getSelectedProject()

std::string vex::ProjectSelector::getSelectedProject ( ) const
inline

Gets the path of the project selected by the user.

Returns
std::string - The path to the selected project.

Definition at line 48 of file ProjectSelector.hpp.

◆ getUserDocumentsDir()

std::filesystem::path vex::ProjectSelector::getUserDocumentsDir ( )
private

Gets the path to the user's documents directory.

Definition at line 429 of file ProjectSelector.cpp.

◆ loadKnownProjects()

void vex::ProjectSelector::loadKnownProjects ( )
private

Loads the list of recently known projects from the configuration file.

Definition at line 275 of file ProjectSelector.cpp.

◆ moveProject()

void vex::ProjectSelector::moveProject ( int index,
const std::string & newParentDir )
private

Moves a project to a new parent directory.

Definition at line 243 of file ProjectSelector.cpp.

◆ removeProject()

void vex::ProjectSelector::removeProject ( int index)
private

Removes a project from the list.

Definition at line 235 of file ProjectSelector.cpp.

◆ render()

void vex::ProjectSelector::render ( )
overridevirtual

Overrides the base render function to draw the project selection UI.

Reimplemented from vex::Engine.

Definition at line 35 of file ProjectSelector.cpp.

◆ saveKnownProjects()

void vex::ProjectSelector::saveKnownProjects ( )
private

Saves the current list of known projects to the configuration file.

Definition at line 291 of file ProjectSelector.cpp.

◆ scanAndAddProject()

void vex::ProjectSelector::scanAndAddProject ( const std::string & path)
private

Scans a directory path for a valid VEX project file and adds it to the list.

Parameters
conststd::string& path - The directory path to scan.

Definition at line 304 of file ProjectSelector.cpp.

◆ selectProject()

void vex::ProjectSelector::selectProject ( const std::string & projectPath)
private

Sets the path of the project that the user selected and triggers the closure of the selector.

Parameters
conststd::string& projectPath - The path of the project selected.

Definition at line 333 of file ProjectSelector.cpp.

Member Data Documentation

◆ closeDelay

uint8_t vex::ProjectSelector::closeDelay = 5
private

Definition at line 125 of file ProjectSelector.hpp.

◆ m_addExistingBuffer

char vex::ProjectSelector::m_addExistingBuffer[512] = ""
private

Definition at line 113 of file ProjectSelector.hpp.

◆ m_configPath

std::string vex::ProjectSelector::m_configPath = "recent_projects.json"
private

Definition at line 119 of file ProjectSelector.hpp.

◆ m_contextMenuTargetIndex

int vex::ProjectSelector::m_contextMenuTargetIndex = -1
private

Definition at line 116 of file ProjectSelector.hpp.

◆ m_inputBuffer

char vex::ProjectSelector::m_inputBuffer[256] = ""
private

Definition at line 120 of file ProjectSelector.hpp.

◆ m_moveProjDestBuffer

char vex::ProjectSelector::m_moveProjDestBuffer[512] = ""
private

Definition at line 114 of file ProjectSelector.hpp.

◆ m_newProjName

char vex::ProjectSelector::m_newProjName[64] = "NewVexProject"
private

Definition at line 110 of file ProjectSelector.hpp.

◆ m_newProjParentDir

char vex::ProjectSelector::m_newProjParentDir[512] = ""
private

Definition at line 111 of file ProjectSelector.hpp.

◆ m_projects

std::vector<ProjectMetadata> vex::ProjectSelector::m_projects
private

Definition at line 118 of file ProjectSelector.hpp.

◆ m_selectedProjectPath

std::string vex::ProjectSelector::m_selectedProjectPath = ""
private

Definition at line 122 of file ProjectSelector.hpp.

◆ m_showAddExistingModal

bool vex::ProjectSelector::m_showAddExistingModal = false
private

Definition at line 127 of file ProjectSelector.hpp.

◆ m_showCreatorModal

bool vex::ProjectSelector::m_showCreatorModal = false
private

Definition at line 126 of file ProjectSelector.hpp.

◆ m_showMoveModal

bool vex::ProjectSelector::m_showMoveModal = false
private

Definition at line 128 of file ProjectSelector.hpp.

◆ shouldClose

bool vex::ProjectSelector::shouldClose = false
private

Definition at line 124 of file ProjectSelector.hpp.


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