mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 01:16:26 +00:00
emscripten: Another attempt at optionally having the canvas use whole window.
Fixes #11949.
This commit is contained in:
@@ -753,6 +753,28 @@ extern "C" {
|
||||
*/
|
||||
#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
|
||||
|
||||
/**
|
||||
* Dictate that newly-created windows will fill the whole browser window.
|
||||
*
|
||||
* The canvas element fills the entire document. Resize events will be
|
||||
* generated as the browser window is resized, as that will adjust the canvas
|
||||
* size as well. The canvas will cover anything else on the page, including
|
||||
* any controls provided by Emscripten in its generated HTML file. Often times
|
||||
* this is desirable for a browser-based game, but it means several things that
|
||||
* we expect of an SDL window on other platforms might not work as expected,
|
||||
* such as minimum window sizes and aspect ratios.
|
||||
*
|
||||
* This hint overrides SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN
|
||||
* properties when creating an SDL window.
|
||||
*
|
||||
* This hint only applies to the emscripten platform.
|
||||
*
|
||||
* This hint should be set before creating a window.
|
||||
*
|
||||
* \since This hint is available since SDL 3.4.0.
|
||||
*/
|
||||
#define SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT "SDL_EMSCRIPTEN_FILL_DOCUMENT"
|
||||
|
||||
/**
|
||||
* A variable that controls whether the on-screen keyboard should be shown
|
||||
* when text input is active.
|
||||
|
@@ -1353,6 +1353,15 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreatePopupWindow(SDL_Window *paren
|
||||
*
|
||||
* - `SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING`: the id given to the
|
||||
* canvas element. This should start with a '#' sign
|
||||
* - `SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN`: true to make
|
||||
* the canvas element fill the entire document. Resize events will be
|
||||
* generated as the browser window is resized, as that will adjust the
|
||||
* canvas size as well. The canvas will cover anything else on the page,
|
||||
* including any controls provided by Emscripten in its generated HTML
|
||||
* file. Often times this is desirable for a browser-based game, but it
|
||||
* means several things that we expect of an SDL window on other platforms
|
||||
* might not work as expected, such as minimum window sizes and aspect
|
||||
* ratios. Default false.
|
||||
* - `SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`: override the
|
||||
* binding element for keyboard inputs for this canvas. The variable can be
|
||||
* one of:
|
||||
@@ -1426,6 +1435,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowWithProperties(SDL_Prop
|
||||
#define SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER "SDL.window.create.win32.pixel_format_hwnd"
|
||||
#define SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER "SDL.window.create.x11.window"
|
||||
#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING "SDL.window.create.emscripten.canvas_id"
|
||||
#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN "SDL.window.create.emscripten.fill_document"
|
||||
#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING "SDL.window.create.emscripten.keyboard_element"
|
||||
|
||||
/**
|
||||
@@ -1595,6 +1605,9 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window)
|
||||
*
|
||||
* - `SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING`: the id the canvas element
|
||||
* will have
|
||||
* - `SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN`: true if the
|
||||
* canvas is set to consume the entire browser window, bypassing some SDL
|
||||
* window functionality.
|
||||
* - `SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`: the keyboard
|
||||
* element that associates keyboard events to this window
|
||||
*
|
||||
@@ -1644,6 +1657,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window
|
||||
#define SDL_PROP_WINDOW_X11_SCREEN_NUMBER "SDL.window.x11.screen"
|
||||
#define SDL_PROP_WINDOW_X11_WINDOW_NUMBER "SDL.window.x11.window"
|
||||
#define SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING "SDL.window.emscripten.canvas_id"
|
||||
#define SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN "SDL.window.emscripten.fill_document"
|
||||
#define SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING "SDL.window.emscripten.keyboard_element"
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user