Loading...
Searching...
No Matches
Project.h
Go to the documentation of this file.
1//
2// Created by denzel on 29/10/2025.
3//
4
5#pragma once
6#include <filesystem>
7#include <memory>
8
9#include "hellfire/assets/AssetManager.h"
10#include "hellfire/assets/AssetRegistry.h"
11#include "hellfire/graphics/renderer/Renderer.h"
12#include "hellfire/scene/SceneManager.h"
13
14namespace hellfire {
16 std::string name;
17 std::string version;
18 std::string engine_version;
19 std::string created_at;
20 std::string last_opened;
21 std::optional<AssetID> last_scene;
22 std::filesystem::path default_scene;
23 std::filesystem::path renderer_settings;
24 };
25
26 class Project {
27 public:
28 explicit Project(const std::string &name);
29 explicit Project(const ProjectMetadata &metadata);
30 ~Project();
31
32 static std::unique_ptr<Project> create(const std::string &name, const std::filesystem::path &location);
33 static std::unique_ptr<Project> load_data(const std::filesystem::path &project_file);
34
36
37 bool save();
38 void close();
39
40 // Project directory structure
41 std::filesystem::path get_project_root() const;
42 std::filesystem::path get_assets_path() const;
43 std::filesystem::path get_scenes_path() const;
44 std::filesystem::path get_settings_path() const;
45
46 // Getters/setters
47 const ProjectMetadata& get_metadata() const { return metadata_; }
48 ProjectMetadata& get_metadata() { return metadata_; }
49
50 const std::string &get_name() const { return metadata_.name; }
51 const std::string &get_version() const { return metadata_.version; }
52
53 SceneManager *get_scene_manager() const { return scene_manager_.get(); }
54 AssetRegistry *get_asset_registry() const { return asset_registry_.get(); }
55 private:
57 std::filesystem::path project_root_path_;
58 std::filesystem::path project_file_path_;
59
64
66
67 private:
68 void create_directory_structure() const;
70 void cleanup_managers();
71
72
73 static std::string get_current_timestamp();
74 };
75}
void import_all_pending()
Import all unprocessed assets in registry.
Registry for storing assets.
const std::string & get_name() const
Definition Project.h:50
std::unique_ptr< AssetManager > asset_manager_
Definition Project.h:62
const ProjectMetadata & get_metadata() const
Definition Project.h:47
ProjectMetadata & get_metadata()
Definition Project.h:48
std::filesystem::path get_assets_path() const
Definition Project.cpp:136
std::filesystem::path get_settings_path() const
Definition Project.cpp:144
AssetRegistry * get_asset_registry() const
Definition Project.h:54
void cleanup_managers()
Definition Project.cpp:196
std::unique_ptr< SceneManager > scene_manager_
Definition Project.h:60
std::vector< std::filesystem::path > recent_scenes_
Definition Project.h:65
void initialize_default_assets()
Definition Project.cpp:157
static std::unique_ptr< Project > create(const std::string &name, const std::filesystem::path &location)
Definition Project.cpp:37
const std::string & get_version() const
Definition Project.h:51
static std::unique_ptr< Project > load_data(const std::filesystem::path &project_file)
Definition Project.cpp:61
std::unique_ptr< Renderer > scene_renderer_
Definition Project.h:63
std::unique_ptr< AssetRegistry > asset_registry_
Definition Project.h:61
Project(const ProjectMetadata &metadata)
Definition Project.cpp:31
SceneManager * get_scene_manager() const
Definition Project.h:53
ProjectMetadata metadata_
Definition Project.h:56
void create_directory_structure() const
Definition Project.cpp:148
std::filesystem::path project_root_path_
Definition Project.h:57
std::filesystem::path project_file_path_
Definition Project.h:58
Project(const std::string &name)
Definition Project.cpp:21
void initialize_managers()
Definition Project.cpp:161
std::filesystem::path get_scenes_path() const
Definition Project.cpp:140
std::filesystem::path get_project_root() const
Definition Project.cpp:132
static std::string get_current_timestamp()
Definition Project.cpp:204
std::filesystem::path renderer_settings
Definition Project.h:23
std::optional< AssetID > last_scene
Definition Project.h:21
std::string created_at
Definition Project.h:19
std::string last_opened
Definition Project.h:20
std::string engine_version
Definition Project.h:18
std::filesystem::path default_scene
Definition Project.h:22
static bool deserialize(std::istream &input, ProjectMetadata *obj)