mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
fix fullscreen
This commit is contained in:
parent
de3581de73
commit
5ef595be1a
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
|
#include <emscripten/html5.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <file/config_file.h>
|
#include <file/config_file.h>
|
||||||
@ -169,7 +170,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
emscripten_set_canvas_size(800, 600);
|
emscripten_set_canvas_element_size("#canvas", 800, 600);
|
||||||
|
emscripten_set_element_css_size("#canvas", 800.0, 600.0);
|
||||||
rarch_main(argc, argv, NULL);
|
rarch_main(argc, argv, NULL);
|
||||||
emscripten_set_main_loop(emscripten_mainloop,
|
emscripten_set_main_loop(emscripten_mainloop,
|
||||||
settings->bools.video_vsync ? 0 : INT_MAX, 1);
|
settings->bools.video_vsync ? 0 : INT_MAX, 1);
|
||||||
|
@ -43,6 +43,8 @@ typedef struct
|
|||||||
#endif
|
#endif
|
||||||
unsigned fb_width;
|
unsigned fb_width;
|
||||||
unsigned fb_height;
|
unsigned fb_height;
|
||||||
|
int initial_width;
|
||||||
|
int initial_height;
|
||||||
} emscripten_ctx_data_t;
|
} emscripten_ctx_data_t;
|
||||||
|
|
||||||
static void gfx_ctx_emscripten_swap_interval(void *data, unsigned interval)
|
static void gfx_ctx_emscripten_swap_interval(void *data, unsigned interval)
|
||||||
@ -93,11 +95,18 @@ static void gfx_ctx_emscripten_check_window(void *data, bool *quit,
|
|||||||
|
|
||||||
gfx_ctx_emscripten_get_canvas_size(&input_width, &input_height);
|
gfx_ctx_emscripten_get_canvas_size(&input_width, &input_height);
|
||||||
|
|
||||||
|
if (input_width == 0 || input_height == 0)
|
||||||
|
{
|
||||||
|
input_width = emscripten->initial_width;
|
||||||
|
input_height = emscripten->initial_height;
|
||||||
|
emscripten->fb_width = emscripten->fb_height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
*width = (unsigned)input_width;
|
*width = (unsigned)input_width;
|
||||||
*height = (unsigned)input_height;
|
*height = (unsigned)input_height;
|
||||||
*resize = false;
|
*resize = false;
|
||||||
|
|
||||||
if (*width != emscripten->fb_width || *height != emscripten->fb_height)
|
if (input_width != emscripten->fb_width || input_height != emscripten->fb_height)
|
||||||
{
|
{
|
||||||
printf("RESIZE: %dx%d\n", input_width, input_height);
|
printf("RESIZE: %dx%d\n", input_width, input_height);
|
||||||
r = emscripten_set_canvas_element_size("#canvas", input_width, input_height);
|
r = emscripten_set_canvas_element_size("#canvas", input_width, input_height);
|
||||||
@ -177,6 +186,8 @@ static void *gfx_ctx_emscripten_init(video_frame_info_t *video_info, void *video
|
|||||||
|
|
||||||
(void)video_driver;
|
(void)video_driver;
|
||||||
|
|
||||||
|
emscripten_get_canvas_element_size("#canvas", &emscripten->initial_width, &emscripten->initial_height);
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
if (g_egl_inited)
|
if (g_egl_inited)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user