Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graphite/engine/assets/include/map.hpp

50 lines
784 B
C++
Raw Permalink Normal View History

2024-01-03 16:05:02 -05:00
#pragma once
#include <asset.hpp>
#include <utility.hpp>
#include <json.hpp>
class Map : public Asset
{
public:
Map(const std::string& path);
nlohmann::json GetContents()
{
return m_contents;
}
void SetContents(nlohmann::json contents)
{
m_contents = contents;
}
void SaveToFile()
{
std::ofstream out;
out.open(m_filepath);
out << m_contents.dump(1);
out.close();
}
std::string GetName() override
{
return Utility::GetFilename(m_filepath);
}
std::string GetPath() override
{
return m_filepath;
}
std::type_index GetType() override
{
return typeid(Map);
}
private:
nlohmann::json m_contents;
std::string m_filepath;
};