mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
assets preloading with preload.json
This commit is contained in:
parent
739282dce9
commit
7449434f5c
8 changed files with 209 additions and 64 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue