You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
/******************************************************************************
|
|
* File - project.h
|
|
* Author - Joey Pollack
|
|
* Date - 2021/11/09 (y/m/d)
|
|
* Mod Date - 2021/11/09 (y/m/d)
|
|
* Description - Manage data for a game project
|
|
******************************************************************************/
|
|
|
|
#ifndef PROJECT_H_
|
|
#define PROJECT_H_
|
|
|
|
#include <utils/op_res.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <filesystem>
|
|
|
|
namespace lunarium { namespace editor
|
|
{
|
|
class ContentManager;
|
|
class World;
|
|
|
|
class Project
|
|
{
|
|
public:
|
|
Project();
|
|
|
|
/// location should NOT include the project file
|
|
[[nodiscard]] OpRes GenerateProject(std::string name, std::filesystem::path location);
|
|
|
|
/// location should be the full path including the project file
|
|
[[nodiscard]] OpRes LoadProject(std::filesystem::path location);
|
|
void UnloadCurrentProject();
|
|
void SaveProject();
|
|
|
|
bool IsLoaded() const;
|
|
const std::string& GetName() const;
|
|
std::filesystem::path GetRootDirectory() const;
|
|
std::filesystem::path GetContentDirectory() const;
|
|
std::filesystem::path GetAssetDirectory() const;
|
|
std::filesystem::path GetTrashDirectory() const;
|
|
|
|
// Convert an absolute path to a path relative to the project root
|
|
std::filesystem::path MakeRelativeToRoot(std::filesystem::path, bool include_root = false) const;
|
|
std::filesystem::path MakeRelativeToAssets(std::filesystem::path, bool include_root = false) const;
|
|
|
|
private:
|
|
bool mIsLoaded;
|
|
std::string mName;
|
|
std::filesystem::path mLocation;
|
|
|
|
ContentManager* mpContentManager;
|
|
std::vector<World*> mWorlds;
|
|
|
|
private:
|
|
void LoadContent();
|
|
std::filesystem::path MakeRelativeTo(std::filesystem::path p, std::filesystem::path rel_to, bool include_root) const;
|
|
};
|
|
}}
|
|
|
|
#endif // PROJECT_H_
|