| 57 | } |
| 58 | |
| 59 | bool ResourcesLoadingLayer::init() |
| 60 | { |
| 61 | _fu = FileUtils::getInstance(); |
| 62 | |
| 63 | for (std::string_view a : _fu->getSearchPaths()) |
| 64 | { |
| 65 | GameToolbox::log("search path: {}", a); |
| 66 | } |
| 67 | //some random files to check if theres already a path added |
| 68 | if (_fu->isFileExist("game_bg_01_001-hd.png") && _fu->isFileExist("GJ_LaunchSheet-hd.png") && _fu->isFileExist("GJ_GameSheet03-uhd.png") && _fu->isFileExist("player_01-hd.png")) |
| 69 | { |
| 70 | loadLoadingLayer(); |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | _gm = GameManager::getInstance(); |
| 75 | _dir = Director::getInstance(); |
| 76 | _writablePath = _fu->getWritablePath(); |
| 77 | |
| 78 | auto winSize = _dir->getWinSize(); |
| 79 | _posMiddle = { winSize.width / 2, winSize.height / 2 }; |
| 80 | |
| 81 | if(auto path = _gm->get<std::string>("resources_path"); !path.empty() && _fu->isDirectoryExist(path)) |
| 82 | { |
| 83 | _fu->addSearchPath(path, true); |
| 84 | _fu->addSearchPath(path + "\\icons", true); |
| 85 | loadLoadingLayer(); |
| 86 | return true; |
| 87 | } |
| 88 | |
| 89 | #if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) |
| 90 | handleWindows(); |
| 91 | #endif |
| 92 | |
| 93 | #if (AX_TARGET_PLATFORM == AX_PLATFORM_MAC) |
| 94 | handleMac(); |
| 95 | #endif |
| 96 | |
| 97 | #if (AX_TARGET_PLATFORM == AX_PLATFORM_LINUX) |
| 98 | handleLinux(); |
| 99 | #endif |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | #if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) |
| 104 | |