From 016e7ce69b08df40bb6a0829499e0157662e235f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ma=C5=A1karinec?= Date: Thu, 20 Jun 2024 20:23:45 +0200 Subject: [PATCH] Add fullscreen sample MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marek Maškarinec --- samples/fullscreen/main.um | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 samples/fullscreen/main.um diff --git a/samples/fullscreen/main.um b/samples/fullscreen/main.um new file mode 100644 index 0000000..6110663 --- /dev/null +++ b/samples/fullscreen/main.um @@ -0,0 +1,31 @@ +import ( + "window.um" + "canvas.um" + "input.um" + "th.um" + "signal.um" +) + +fn init*() { + window::setup("Fullscreen Sample", 640, 480) + + window::onFrame.register(signal::Callback{ + canvas::drawText("[ALT + ENTER] TO ENTER FULLSCREEN", th::Vf2{0, 0}, th::black, 2) + canvas::drawText("[ESC] TO EXIT FULLSCREEN", th::Vf2{0, 11}, th::black, 2) + canvas::drawText("NOTE: THE FULLSCREEN HOTKEYS ARE CONFIGURED MANUALLY", th::Vf2{0, 22}, th::black, 2) + + if window::isFullscreen() { + canvas::drawText("FULLSCREEN ON", th::Vf2{0, 33}, th::green, 4) + } else { + canvas::drawText("FULLSCREEN OFF", th::Vf2{0, 33}, th::red, 4) + } + + if input::isPressed(input::Key.alt) && input::isJustPressed(input::Key.enter) { + window::setFullscreen(true) + } + + if input::isJustPressed(input::Key.escape) { + window::setFullscreen(false) + } + }) +}