Skip to content

Commit

Permalink
Merge branch 'the-merge' of github.com:X-R-G-B/R-Bus into the-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
romainpanno committed Nov 5, 2023
2 parents b4a4908 + 7695032 commit aadce62
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Client/Systems/Menus/Menu/MenuSystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,28 @@ namespace Systems {
Json::getInstance().getDatasFromList(jsonData));
}

static void preloadTexture()
{
std::vector<std::string> textures = Json::getInstance().getDatasByKey(
{ResourcesManager::getPathByJsonType(JsonType::ENEMIES),
ResourcesManager::getPathByJsonType(JsonType::DEFAULT_PARALLAX),
ResourcesManager::getPathByJsonType(JsonType::DEFAULT_PLAYER)},
"spritePath");
for (auto elem : textures) {
std::string::iterator end_pos = std::remove(elem.begin(), elem.end(), '"');
elem.erase(end_pos, elem.end());
Raylib::TextureManager::getInstance().preloadTexture(elem);
}
}

void initSceneGame(std::size_t managerId, std::size_t systemId)
{
if (Scene::SceneManager::getInstance().getCurrentScene() != GAME) {
return;
}
try {
Parallax::initParalax();
preloadTexture();
initHud();
} catch (std::runtime_error &err) {
Logger::info(err.what());
Expand Down

0 comments on commit aadce62

Please sign in to comment.