macOS Support & AppPlatform Cleanup (#57)

* macOS Support & Cleanup

* Fix malformed comments in build-wasm.bat

* Emscripten Fixes

* * Add shebang to the grabsounds.py script

Since it was changed from rw- to rwx, I'll add the shebang so that it actually runs properly.

* * Re-add the patch_data and readme files.

* * Remove sound data.

* Fix some more things.

* Think it's ready to pull now...

---------

Co-authored-by: BrentDaMage <BrentDaMage@users.noreply.github.com>
Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com>
This commit is contained in:
Brent
2023-08-17 03:20:59 -05:00
committed by GitHub
parent 906b96edd8
commit 5ac3aa6d9e
60 changed files with 3145 additions and 274 deletions

View File

@@ -0,0 +1,33 @@
#include "AppPlatform_emscripten.hpp"
#include <emscripten.h>
#include "client/common/Utils.hpp"
AppPlatform_emscripten::AppPlatform_emscripten(std::string storageDir, SDL_Window *window)
: AppPlatform_sdlbase(storageDir, window)
{
}
Texture AppPlatform_emscripten::loadTexture(const std::string& path, bool b)
{
Texture out;
out.field_C = 1;
out.field_D = 0;
std::string realPath = getAssetPath(path);
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);
free(data);
return out;
}
// I don't think this logic makes any sense
LogMsg("Couldn't find file: %s", realPath.c_str());
return out;
}