Ankush's Garage
A collection of stuff made by Ankush Roy
Loading...
Searching...
No Matches
BaseProject.h
Go to the documentation of this file.
1#ifndef INCLUDE_COMMON_BASEPROJECT_H_
2#define INCLUDE_COMMON_BASEPROJECT_H_
3
4#include "Core/Common/pch.h"
5#include <memory>
6
7namespace Common
8{
9
17{
18 public:
19 virtual ~BaseProject() = default;
20
21 virtual bool Init() = 0;
22 virtual bool Update() = 0;
23 virtual bool Draw() = 0;
24 virtual void Quit() = 0;
25
26 [[nodiscard]] virtual const std::string &GetName() = 0;
27 static bool hasUI;
28};
29
31{
32 public:
33 virtual ~ImGuiUI() = default;
34 virtual bool DrawUI() = 0;
35};
36
38{
39 public:
42
44 ProjectManager(const ProjectManager &) = delete;
47
48 using ProjVec = std::vector<std::unique_ptr<BaseProject>>;
49
50 static std::shared_ptr<ProjVec> GetProjects();
51
55 static void RegisterAllProjects(); // defined in RegisgerProjects.cpp
56
57 private:
58 static void RegisterProject(std::unique_ptr<BaseProject> project);
59 static std::shared_ptr<ProjVec> instance;
60};
61
62} // namespace Common
63
64#endif // INCLUDE_COMMON_BASEPROJECT_H_
Structure representing an project application instance.
Definition BaseProject.h:17
virtual const std::string & GetName()=0
virtual void Quit()=0
virtual bool Init()=0
virtual bool Draw()=0
virtual bool Update()=0
static bool hasUI
Definition BaseProject.h:27
virtual ~BaseProject()=default
Definition BaseProject.h:31
virtual ~ImGuiUI()=default
virtual bool DrawUI()=0
static void RegisterProject(std::unique_ptr< BaseProject > project)
Definition BaseProject.cpp:17
ProjectManager & operator=(const ProjectManager &)=delete
static std::shared_ptr< ProjVec > instance
Definition BaseProject.h:59
static std::shared_ptr< ProjVec > GetProjects()
Definition BaseProject.cpp:12
ProjectManager(ProjectManager &&)=delete
ProjectManager & operator=(ProjectManager &&)=delete
static void RegisterAllProjects()
registers all the projects to the vector, should be called before calling getProjects()
Definition RegisterProjects.cpp:10
std::vector< std::unique_ptr< BaseProject > > ProjVec
Definition BaseProject.h:48
ProjectManager(const ProjectManager &)=delete
Definition Common.cpp:5