mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
Fix Texture Detection
This commit is contained in:
committed by
iProgramInCpp
parent
ec12755632
commit
433b1532d9
@@ -28,3 +28,23 @@ Texture AppPlatform_sdl::loadTexture(const std::string& path, bool b)
|
||||
LOG_E("Couldn't find file: %s", realPath.c_str());
|
||||
return out;
|
||||
}
|
||||
bool AppPlatform_sdl::doesTextureExist(const std::string& path)
|
||||
{
|
||||
// Get Full Path
|
||||
std::string realPath = getAssetPath(path);
|
||||
|
||||
// Open File
|
||||
int width = 0, height = 0;
|
||||
char *data = emscripten_get_preloaded_image_data(("/" + realPath).c_str(), &width, &height);
|
||||
if (!data)
|
||||
{
|
||||
// Does Not Exist
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// File Exists
|
||||
free(data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user