Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
textasset.h
Go to the documentation of this file.
1/* Conquer Space
2 * Copyright (C) 2021-2023 Conquer Space
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <hjson.h>
20
21#include <map>
22#include <string>
23#include <vector>
24
25#include "engine/asset/asset.h"
26
27namespace cqsp::asset {
28class TextAsset : public Asset {
29 public:
30 std::string data;
31 AssetType GetAssetType() override { return AssetType::TEXT; }
32};
33
38 public:
39 // Relative path for the asset compared to the resource.hjson
40 std::string data;
41 std::string path;
42
43 operator std::string() { return data; }
44};
45
49class TextDirectoryAsset : public Asset {
50 public:
51 // Get the path of the assets
52 std::map<std::string, PathedTextAsset> paths;
54};
55
56class HjsonAsset : public Asset {
57 public:
58 Hjson::Value data;
60};
61
62class BinaryAsset : public Asset {
63 public:
64 std::vector<uint8_t> data;
66};
67} // namespace cqsp::asset
The base class for assets.
Definition: asset.h:159
Definition: textasset.h:62
std::vector< uint8_t > data
Definition: textasset.h:64
AssetType GetAssetType() override
Definition: textasset.h:65
Definition: textasset.h:56
Hjson::Value data
Definition: textasset.h:58
AssetType GetAssetType() override
Definition: textasset.h:59
Text asset which remembers what it's path is.
Definition: textasset.h:37
std::string data
Definition: textasset.h:40
std::string path
Definition: textasset.h:41
Definition: textasset.h:28
std::string data
Definition: textasset.h:30
AssetType GetAssetType() override
Definition: textasset.h:31
Asset to store a directory of text files, and remembers the path of the assets.
Definition: textasset.h:49
AssetType GetAssetType() override
Definition: textasset.h:53
std::map< std::string, PathedTextAsset > paths
Definition: textasset.h:52
Definition: asset.h:30
AssetType
Definition: asset.h:33
@ TEXT
text as the type parameter in resource.hjson
@ HJSON
hjson as the type parameter in resource.hjson