tetris: enable to run on android, run v fmt (#8136)
parent
371730f8a8
commit
4044abef0e
|
@ -53,15 +53,15 @@ const (
|
|||
]
|
||||
// Each tetro has its unique color
|
||||
colors = [
|
||||
gx.rgb(0, 0, 0), // unused ?
|
||||
gx.rgb(255, 242, 0), // yellow quad
|
||||
gx.rgb(174, 0, 255), // purple triple
|
||||
gx.rgb(60, 255, 0), // green short topright
|
||||
gx.rgb(255, 0, 0), // red short topleft
|
||||
gx.rgb(255, 180, 31), // orange long topleft
|
||||
gx.rgb(33, 66, 255), // blue long topright
|
||||
gx.rgb(74, 198, 255), // lightblue longest
|
||||
gx.rgb(0, 170, 170), // unused ?
|
||||
gx.rgb(0, 0, 0), /* unused ? */
|
||||
gx.rgb(255, 242, 0), /* yellow quad */
|
||||
gx.rgb(174, 0, 255), /* purple triple */
|
||||
gx.rgb(60, 255, 0), /* green short topright */
|
||||
gx.rgb(255, 0, 0), /* red short topleft */
|
||||
gx.rgb(255, 180, 31), /* orange long topleft */
|
||||
gx.rgb(33, 66, 255), /* blue long topright */
|
||||
gx.rgb(74, 198, 255), /* lightblue longest */
|
||||
gx.rgb(0, 170, 170), /* unused ? */
|
||||
]
|
||||
background_color = gx.white
|
||||
ui_color = gx.rgba(255, 0, 0, 210)
|
||||
|
@ -119,10 +119,6 @@ mut:
|
|||
second_sw time.StopWatch = time.new_stopwatch({})
|
||||
}
|
||||
|
||||
const (
|
||||
fpath = os.resource_abs_path('../assets/fonts/RobotoMono-Regular.ttf')
|
||||
)
|
||||
|
||||
[if showfps]
|
||||
fn (mut game Game) showfps() {
|
||||
game.frame++
|
||||
|
@ -150,7 +146,11 @@ fn main() {
|
|||
mut game := &Game{
|
||||
gg: 0
|
||||
}
|
||||
game.gg = gg.new_context({
|
||||
mut fpath := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
|
||||
$if android {
|
||||
fpath = 'fonts/RobotoMono-Regular.ttf'
|
||||
}
|
||||
game.gg = gg.new_context(
|
||||
bg_color: gx.white
|
||||
width: win_width
|
||||
height: win_height
|
||||
|
@ -161,7 +161,7 @@ fn main() {
|
|||
frame_fn: frame
|
||||
event_fn: on_event
|
||||
font_path: fpath // wait_events: true
|
||||
})
|
||||
)
|
||||
game.init_game()
|
||||
go game.run() // Run the game loop in a new thread
|
||||
game.gg.run() // Run the render loop in the main thread
|
||||
|
|
Loading…
Reference in New Issue