I can’t figure out how to do this with logic nodes. I see there is a ‘get window resolution’ node, but no ‘set resolution node’ and don’t see any nodes for toggling if the game is fullscreen or not. Trying to make an options menu for a game. I tried searching these forums, but couldn’t find anything.
From my experience with Armory3D so far, it’s not exactly possible yet except for HTML builds of the game: Fullscreen or not fullscreen (html5)
However there does seem to be a way to program that into exported native builds using Visual Studio / platform specific applications: Armory most wanted? - #30 by sans-iccal
Best compromise I could find is exporting two versions - One that’s Fullscreen and the other that’s windowed. Course it’s not the best solution, but it works until that gets added into the source code.
Might just be because I’m doing it wrong, but I don’t think Armory (specifically Kha?) supports dynamically editing of window properties.
Some quick tests I ran
kha.WindowMode.Fullscreen = 0;
Cannot access field or identifier Fullscreen for writing
kha.Display.all[0].width = 800;
Cannot access field or identifier width for writing
kha.Display.all[0].height = 600;
Cannot access field or identifier height for writing
To change the window display mode, you can run the following code (use the API of the Kha
library):
package arm;
import kha.input.KeyCode;
import iron.system.Input;
import kha.Window;
class MyTrait extends iron.Trait {
public function new() {
super();
notifyOnUpdate(function() {
if (Input.getKeyboard().started(Keyboard.keyCode(KeyCode.F))) {
if (Window.get(0).mode == Windowed) {
Window.get(0).mode = ExclusiveFullscreen;
} else {
Window.get(0).mode = Windowed;
}
}
});
}
}
But it doesn’t work when running from Krom
. But it works in the browser and I think it will work if you make a native build (C
). I checked the native build when working with Kha
.