Skip to content

Commit

Permalink
examples/2048: remove the emscripten specific code from examples/2048…
Browse files Browse the repository at this point in the history
…/2048.v (moved to gg.c.v)
  • Loading branch information
spytheman committed Aug 13, 2023
1 parent ca0f589 commit 33965bc
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions examples/2048/2048.v
Original file line number Diff line number Diff line change
Expand Up @@ -909,32 +909,21 @@ fn (mut app App) showfps() {
}
}

$if emscripten ? {
#flag --embed-file ./examples/assets/fonts/RobotoMono-Regular.ttf@/assets/fonts/RobotoMono-Regular.ttf
}

fn main() {
mut app := &App{}
app.new_game()
mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
$if android {
font_path = 'fonts/RobotoMono-Regular.ttf'
}
mut window_title_ := 'V 2048'
// TODO: Make emcc a real platform ifdef
$if emscripten ? {
// in emscripten, sokol uses `window_title` as the selector to the canvas it'll render to,
// and since `document.querySelector('V 2048')` isn't valid JS, we use `canvas` instead
window_title_ = 'canvas'
}
app.perf = &Perf{}
app.gg = gg.new_context(
bg_color: app.theme.bg_color
width: default_window_width
height: default_window_height
sample_count: 4 // higher quality curves
create_window: true
window_title: window_title_
window_title: 'V 2048'
frame_fn: frame
event_fn: on_event
init_fn: init
Expand Down

0 comments on commit 33965bc

Please sign in to comment.