Adds World Editor Asset
World assets can be created from the AssetBrowser context menumaster
parent
5c83a63b3c
commit
b49ae6484c
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
|
☐ Create base classes for serializeable objects
|
||||||
|
☐ JSON serializeable
|
||||||
|
☐ Binary serializeable
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* File - world.h
|
||||||
|
* Author - Joey Pollack
|
||||||
|
* Date - 2022/06/28 (y/m/d)
|
||||||
|
* Mod Date - 2022/06/28 (y/m/d)
|
||||||
|
* Description - Editor asset for a World object
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "world.h"
|
||||||
|
|
||||||
|
#include <world/world.h>
|
||||||
|
|
||||||
|
namespace lunarium { namespace editor
|
||||||
|
{
|
||||||
|
World::World(std::filesystem::path name)
|
||||||
|
: EditorAsset(AssetType::EATYPE_WORLD), mpWorld(new lunarium::World)
|
||||||
|
{
|
||||||
|
mLocation = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
World::~World()
|
||||||
|
{
|
||||||
|
delete mpWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
lunarium::World* World::GetWorld()
|
||||||
|
{
|
||||||
|
return mpWorld;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpRes World::LoadRawFile()
|
||||||
|
{
|
||||||
|
return OpRes::OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
OpRes World::LoadFromJSON(nlohmann::json& node)
|
||||||
|
{
|
||||||
|
// TODO: Implement World::LoadFromJSON
|
||||||
|
// Create the lunarium::World Object here
|
||||||
|
// Replace the one created in the constructor
|
||||||
|
return OpRes::OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
OpRes World::SaveToJSON(nlohmann::json& node)
|
||||||
|
{
|
||||||
|
// TODO: Implement World::SaveToJSON
|
||||||
|
// Store the entities UUID - the Entity class will serialize itself
|
||||||
|
return OpRes::OK();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool World::IsValidNode(nlohmann::json& node)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* File - world.h
|
||||||
|
* Author - Joey Pollack
|
||||||
|
* Date - 2022/06/28 (y/m/d)
|
||||||
|
* Mod Date - 2022/06/28 (y/m/d)
|
||||||
|
* Description - Editor asset for a World object
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef LUNARIUM_EDITOR_WORLD_H_
|
||||||
|
#define LUNARIUM_EDITOR_WORLD_H_
|
||||||
|
|
||||||
|
#include "editor_asset.h"
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
namespace lunarium
|
||||||
|
{
|
||||||
|
class World;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace lunarium { namespace editor
|
||||||
|
{
|
||||||
|
|
||||||
|
class World : public EditorAsset
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
World(std::filesystem::path name = "WORLD");
|
||||||
|
~World();
|
||||||
|
|
||||||
|
[[nodiscard]] virtual OpRes LoadRawFile();
|
||||||
|
[[nodiscard]] virtual OpRes LoadFromJSON(nlohmann::json& node);
|
||||||
|
[[nodiscard]] virtual OpRes SaveToJSON(nlohmann::json& node);
|
||||||
|
|
||||||
|
lunarium::World* GetWorld();
|
||||||
|
|
||||||
|
private: // DATA
|
||||||
|
lunarium::World* mpWorld;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
[[nodiscord]] virtual bool IsValidNode(nlohmann::json& node);
|
||||||
|
|
||||||
|
|
||||||
|
private: // DISABLED
|
||||||
|
World(const World&) = delete;
|
||||||
|
World& operator=(const World&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // LUNARIUM_EDITOR_WORLD_H_
|
||||||
Loading…
Reference in New Issue