Skip to content

Commit

Permalink
Add fullscreen sample
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Maškarinec <marek@mrms.cz>
  • Loading branch information
marekmaskarinec committed Jun 20, 2024
1 parent c12f998 commit 016e7ce
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions samples/fullscreen/main.um
Original file line number Diff line number Diff line change
@@ -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)
}
})
}

0 comments on commit 016e7ce

Please sign in to comment.