VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
ProjectSelector.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include "Engine.hpp"
14#include "components/Window.hpp"
15
19
20#include <cstdint>
21#include <vector>
22#include <string>
23
24namespace vex {
25
28 std::string name;
29 std::string path;
30 std::string version;
31 };
32
34 class ProjectSelector : public Engine {
35 public:
40 ProjectSelector(const char* title);
41 ~ProjectSelector() = default;
42
44 void render() override;
45
48 std::string getSelectedProject() const { return m_selectedProjectPath; }
49
50 private:
55 void drawSelectorLayout(const SceneRenderData& data);
56
58 void loadKnownProjects();
59
61 void saveKnownProjects();
62
67 void scanAndAddProject(const std::string& path);
68
73 void selectProject(const std::string& projectPath);
74
78 void drawCreatorModal();
79
84
89
93 void createNewProject();
94
98 void removeProject(int index);
99
103 void moveProject(int index, const std::string& newParentDir);
104
108 std::filesystem::path getUserDocumentsDir();
109
110 char m_newProjName[64] = "NewVexProject";
111 char m_newProjParentDir[512] = "";
112
113 char m_addExistingBuffer[512] = "";
114 char m_moveProjDestBuffer[512] = "";
115
116 int m_contextMenuTargetIndex = -1;
117
118 std::vector<ProjectMetadata> m_projects;
119 std::string m_configPath = "recent_projects.json";
120 char m_inputBuffer[256] = "";
121
122 std::string m_selectedProjectPath = "";
123
124 bool shouldClose = false;
125 uint8_t closeDelay = 5;
126 bool m_showCreatorModal = false;
127 bool m_showAddExistingModal = false;
128 bool m_showMoveModal = false;
129 };
130}
This file defines in engine CameraObject class.
Contains main Engine class.
This file defines InputSystem class.
This file defines interface Class for vulkan backend.
This file defines Renderer Class.
This file defines ResolutionManager class and ResolutionMode struct.
This file defines SceneManager class.
This file defines class with Imgui for vulkan backend definition.
This file defines Window class.
Engine(const char *title, int width, int height, GameInfo gInfo)
Constructor for the Engine class.
Definition Engine.cpp:46
void drawAddExistingModal()
Draws the modal for adding an existing project.
void drawMoveProjectModal()
Draws the modal for moving an existing project.
void drawSelectorLayout(const SceneRenderData &data)
Internal helper to draw the ImGUI layout for the project selector.
void render() override
Overrides the base render function to draw the project selection UI.
std::filesystem::path getUserDocumentsDir()
Gets the path to the user's documents directory.
void removeProject(int index)
Removes a project from the list.
std::string getSelectedProject() const
Gets the path of the project selected by the user.
void saveKnownProjects()
Saves the current list of known projects to the configuration file.
void drawCreatorModal()
Draws the modal for creating a new project.
void createNewProject()
Creates a new project with the given name and path.
void loadKnownProjects()
Loads the list of recently known projects from the configuration file.
void moveProject(int index, const std::string &newParentDir)
Moves a project to a new parent directory.
void selectProject(const std::string &projectPath)
Sets the path of the project that the user selected and triggers the closure of the selector.
ProjectSelector(const char *title)
Constructs the ProjectSelector window.
void scanAndAddProject(const std::string &path)
Scans a directory path for a valid VEX project file and adds it to the list.
Metadata structure for a recently used project.
Data structure to pass state between render stages.
Definition Renderer.hpp:57