assets preloading with preload.json

This commit is contained in:
MihailRis
2024-03-11 15:09:21 +03:00
parent 739282dce9
commit 7449434f5c
8 changed files with 209 additions and 64 deletions
+28
View File
@@ -155,6 +155,34 @@ void Map::str(std::string key, std::string& dst) const {
dst = getStr(key, dst);
}
std::string Map::getStr(std::string key) const {
if (values.find(key) == values.end()) {
throw std::runtime_error("missing key '"+key+"'");
}
return getStr(key, "");
}
double Map::getNum(std::string key) const {
if (values.find(key) == values.end()) {
throw std::runtime_error("missing key '"+key+"'");
}
return getNum(key, 0);
}
int64_t Map::getInt(std::string key) const {
if (values.find(key) == values.end()) {
throw std::runtime_error("missing key '"+key+"'");
}
return getInt(key, 0);
}
bool Map::getBool(std::string key) const {
if (values.find(key) == values.end()) {
throw std::runtime_error("missing key '"+key+"'");
}
return getBool(key, false);
}
std::string Map::getStr(std::string key, const std::string& def) const {
auto found = values.find(key);
if (found == values.end())