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