[EMSCRIPTEN] buildfix, implement detecting canvas size changes

This commit is contained in:
ToadKing 2013-08-25 15:39:50 -04:00
parent 87844cc486
commit c30d0287d1
2 changed files with 17 additions and 5 deletions

View File

@ -86,7 +86,7 @@ ifeq ($(HAVE_THREADS), 1)
endif
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/emscriptenegl_ctx.o gfx/shader_glsl.o
OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/emscriptenegl_ctx.o gfx/shader_glsl.o gfx/glsym/rglgen.o gfx/glsym/glsym_es2.o
DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_EGL -DHAVE_OVERLAY -DHAVE_GLSL
endif

View File

@ -28,6 +28,7 @@
#include <stdint.h>
#include <unistd.h>
#include <emscripten/emscripten.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <SDL/SDL.h>
@ -52,10 +53,19 @@ static void gfx_ctx_check_window(bool *quit,
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
{
(void)frame_count;
(void)width;
(void)height;
int iWidth, iHeight, isFullscreen;
*resize = false;
emscripten_get_canvas_size(&iWidth, &iHeight, &isFullscreen);
*width = (unsigned) iWidth;
*height = (unsigned) iHeight;
if (*width != g_fb_width || *height != g_fb_height)
*resize = true;
else
*resize = false;
g_fb_width = (unsigned) iWidth;
g_fb_height = (unsigned) iHeight;
*quit = false;
}
@ -167,8 +177,10 @@ static bool gfx_ctx_set_video_mode(
return true;
}
static bool gfx_ctx_bind_api(enum gfx_ctx_api api)
static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor)
{
(void)major;
(void)minor;
switch (api)
{
case GFX_CTX_OPENGL_ES_API: