Fix wasm compilation issues;

This commit is contained in:
bjorn 2021-02-19 09:05:57 -07:00
parent 0365f51f9d
commit a2b7e1619d
3 changed files with 5 additions and 4 deletions

View File

@ -155,8 +155,7 @@ ifeq ($(PLATFORM),web)
LDFLAGS += -s EXPORTED_FUNCTIONS="['_main','_lovrDestroy','_webxr_attach','_webxr_detach','_lovrCanvasCreateFromHandle','_lovrCanvasDestroy','_lovrGraphicsSetBackbuffer','_lovrGraphicsSetViewMatrix','_lovrGraphicsSetProjection']"
LDFLAGS_@(WEBXR) += --js-library $(ROOT)/src/resources/webxr.js
LDFLAGS += --shell-file $(ROOT)/src/resources/lovr.html
CFLAGS_@(THREAD) += -s USE_PTHREADS=1
LDFLAGS_@(THREAD) += -s USE_PTHREADS=1
FLAGS_@(THREAD) += -s USE_PTHREADS=1
EXTRAS = bin/lovr.js bin/lovr.wasm
EXTRAS_@(THREAD) += bin/lovr.worker.js
endif

View File

@ -356,9 +356,9 @@ void lovrPlatformSetMouseMode(MouseMode mode) {
if (state.mouseMode != mode) {
state.mouseMode = mode;
if (mode == MOUSE_MODE_GRABBED) {
EM_ASM(Module['canvas'].requestPointerLock());
emscripten_run_script("Module['canvas'].requestPointerLock();");
} else {
EM_ASM(document.exitPointerLock());
emscripten_run_script("document.exitPointerLock();");
}
}
}

View File

@ -1232,6 +1232,7 @@ static void lovrGpuSetViewports(float* viewport, uint32_t count) {
// GPU
#ifndef LOVR_WEBGL
static void GLAPIENTRY onMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userdata) {
int level;
switch (severity) {
@ -1242,6 +1243,7 @@ static void GLAPIENTRY onMessage(GLenum source, GLenum type, GLuint id, GLenum s
}
lovrLog(level, "GL", message);
}
#endif
void lovrGpuInit(void* (*getProcAddress)(const char*), bool debug) {
#ifdef LOVR_GL