* A couple of fixes for SDL/Emscripten build.

This commit is contained in:
iProgramInCpp
2023-08-17 17:49:52 +03:00
parent 5707419665
commit 8a38dee562
5 changed files with 47 additions and 21 deletions

View File

@@ -20,9 +20,9 @@ Texture AppPlatform_emscripten::loadTexture(const std::string& path, bool b)
char *data = emscripten_get_preloaded_image_data(("/" + realPath).c_str(), &out.m_width, &out.m_height);
if (data != NULL)
{
size_t data_size = out.m_width * out.m_height * 4;
out.m_pixels = (uint32_t *) new unsigned char[data_size];
memcpy(out.m_pixels, data, data_size);
size_t data_size = out.m_width * out.m_height;
out.m_pixels = new uint32_t[data_size];
memcpy(out.m_pixels, data, data_size * sizeof(uint32_t));
free(data);
return out;
}