This commit is contained in:
Alexander Popov 2023-07-02 19:44:00 +03:00
parent c22309081a
commit 8a189a9523
1 changed files with 11 additions and 18 deletions

View File

@ -65,9 +65,8 @@ fn main() {
lives: 3 lives: 3
} }
game.player.image = game.gg.create_image(os.resource_abs_path(os.join_path('..', '..', '.assets', 'v-logo.png'))) or { game.player.image = game.gg.create_image(os.resource_abs_path(os.join_path('..', '..',
panic(err) '.assets', 'v-logo.png'))) or { panic(err) }
}
println('OK!\n') println('OK!\n')
println('High DPI: ${gg.high_dpi()}') println('High DPI: ${gg.high_dpi()}')
@ -81,25 +80,19 @@ fn main() {
fn (mut game Game) key_down(key gg.KeyCode) { fn (mut game Game) key_down(key gg.KeyCode) {
match key { match key {
.escape { // vfmt off
game.gg.quit() .escape { game.gg.quit() }
} // vfmt on
.f11 { .f11 {
sapp.toggle_fullscreen() sapp.toggle_fullscreen()
println('Set fullscreen: ${gg.is_fullscreen()}') println('Set fullscreen: ${gg.is_fullscreen()}')
} }
.left { // vfmt off
game.player.pos_x -= 2 .left { game.player.pos_x -= 2 }
} .right { game.player.pos_x += 2 }
.right { .up { game.player.pos_y -= 2 }
game.player.pos_x += 2 .down { game.player.pos_y += 2 }
} // vfmt on
.up {
game.player.pos_y -= 2
}
.down {
game.player.pos_y += 2
}
else {} else {}
} }
} }