metaforce/Editor/ProjectManager.hpp

59 lines
1.7 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-12-13 21:01:32 +00:00
2017-12-29 08:08:12 +00:00
#include "hecl/Database.hpp"
#include "athena/DNAYaml.hpp"
#include "ProjectResourceFactoryMP1.hpp"
2016-02-16 05:50:41 +00:00
#include "Runtime/CSimplePool.hpp"
2016-04-04 02:32:57 +00:00
#include "hecl/Runtime.hpp"
2016-04-15 20:42:40 +00:00
#include "MP1/MP1.hpp"
2015-12-13 21:01:32 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
2016-01-04 05:31:02 +00:00
class ViewManager;
2015-12-13 21:01:32 +00:00
2016-03-04 23:04:53 +00:00
using ConfigReader = athena::io::YAMLDocReader;
using ConfigWriter = athena::io::YAMLDocWriter;
2016-01-05 00:01:02 +00:00
2018-12-08 05:30:43 +00:00
class ProjectResourcePool : public CSimplePool {
class ProjectManager& m_parent;
public:
2018-12-08 05:30:43 +00:00
ProjectResourcePool(IFactory& factory, ProjectManager& parent) : CSimplePool(factory), m_parent(parent) {}
CToken GetObj(std::string_view) override;
CToken GetObj(std::string_view, const CVParamTransfer&) override;
};
2018-12-08 05:30:43 +00:00
class ProjectManager {
ViewManager& m_vm;
std::unique_ptr<hecl::Database::Project> m_proj;
static bool m_registeredSpecs;
hecl::ClientProcess m_clientProc;
ProjectResourceFactoryMP1 m_factoryMP1;
ProjectResourcePool m_objStore;
std::optional<MP1::CMain> m_mainMP1;
2018-12-08 05:30:43 +00:00
bool m_precooking = false;
2016-02-16 05:50:41 +00:00
2015-12-13 21:01:32 +00:00
public:
2018-12-08 05:30:43 +00:00
static ProjectManager* g_SharedManager;
ProjectManager(ViewManager& vm);
operator bool() const { return m_proj.operator bool(); }
hecl::Database::Project* project() { return m_proj.get(); }
ProjectResourcePool& objectStore() { return m_objStore; }
ProjectResourceFactoryMP1& resourceFactoryMP1() { return m_factoryMP1; }
MP1::CMain* gameMain() { return m_mainMP1 ? &*m_mainMP1 : nullptr; }
SObjectTag TagFromPath(hecl::SystemStringView path) const {
return m_factoryMP1.ProjectResourceFactoryBase::TagFromPath(path);
}
bool newProject(hecl::SystemStringView path);
bool openProject(hecl::SystemStringView path);
bool extractGame(hecl::SystemStringView path);
bool saveProject();
void mainUpdate();
void mainDraw();
void shutdown();
2015-12-13 21:01:32 +00:00
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce