Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Zappo_II |
Hi there…
I’m trying to implement a FullScreen toggle in my Godot 3.0 game, which is working perfectly well on Linux- and Windows exports…
Looks like this…
if Input.is_action_just_released("ui_toggleFullscreen"):
OS.window_fullscreen = !OS.window_fullscreen
get_node("NEDB-PD-SUBCaptions").add_infoMessage("Toggle FullScreen " + ("on" if OS.window_fullscreen else "off"))
In my Linux / Windows export it expectedly states “Toggle Fullscreen on” / “Toggle FullScreen off” respectively…
However in the HTML5 export it doesn’t…
No matter how often I trigger ui_toggleFullscreen it always responds “Toggle FullScreen off”
I’m trying to understand this (https://docs.godotengine.org/en/3.0/getting_started/workflow/export/exporting_for_web.html#full-screen-and-mouse-capture) description I found while RTFM but obviously I’m not smart enough to get the concept… : - / …
Could anybody try to make me understand…please…???
THX and cheers…
Do you have your code inside of a _input or _unhandled_input function?
Or could you paste the whole funciton the you use and where you call it or trough what action in the UI?
coffeeDragon | 2018-11-14 14:58
Code Snippet of above is in _process(delta)
where I handle all my inputs for global game mode stuff like that…
No code in neither _input() nor _unhandled_input() …
Its less a technical coding questen but more a general concept question since I am unable to understand what the DOCs try to tell me with this one:
Instead, these actions have to occur as a response to a JavaScript input event. In Godot, this is most easily done by entering full screen from within an input callback such as _input or _unhandled_input.
What I’d like to achive is, pressing a specific Key in the Game context (aka GODOT Engine Game Code) lets the Browser switch to FullScreen…
I have some Ideas of how to do that in (non GODOT Engine Game Code) JavaScript surrounding the HTML5 index template but I don’t think thats the way it’s ment to be…
Zappo_II | 2018-11-14 15:40
Perhaps you could add a clickable button to toggle fullscreen instead — I’m not sure if all browsers allow keys to enter fullscreen mode.
Calinou | 2018-11-15 13:49