mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
@ -950,12 +950,12 @@ fn main() {
|
||||
$if android {
|
||||
font_path = 'fonts/RobotoMono-Regular.ttf'
|
||||
}
|
||||
mut window_title := 'V 2048'
|
||||
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'
|
||||
window_title_ = 'canvas'
|
||||
}
|
||||
app.perf = &Perf{}
|
||||
app.gg = gg.new_context({
|
||||
@ -964,7 +964,7 @@ fn main() {
|
||||
height: default_window_height
|
||||
sample_count: 8 // higher quality curves
|
||||
create_window: true
|
||||
window_title: window_title
|
||||
window_title: window_title_
|
||||
frame_fn: frame
|
||||
event_fn: on_event
|
||||
init_fn: init
|
||||
|
@ -323,14 +323,14 @@ fn (mut app App) paint(event &tui.Event) {
|
||||
}
|
||||
|
||||
fn (mut app App) draw_content() {
|
||||
w, mut h := app.tui.window_width / 2, app.tui.window_height - 8
|
||||
if h > app.drawing.len {
|
||||
h = app.drawing.len
|
||||
w_, mut h_ := app.tui.window_width / 2, app.tui.window_height - 8
|
||||
if h_ > app.drawing.len {
|
||||
h_ = app.drawing.len
|
||||
}
|
||||
for row_idx, row in app.drawing[..h] {
|
||||
for row_idx, row in app.drawing[..h_] {
|
||||
app.tui.set_cursor_position(0, row_idx + 4)
|
||||
mut last := tui.Color{0, 0, 0}
|
||||
for cell in row[..w] {
|
||||
for cell in row[..w_] {
|
||||
if cell.r == 0 && cell.g == 0 && cell.b == 0 {
|
||||
if !(cell.r == last.r && cell.g == last.g && cell.b == last.b) {
|
||||
app.tui.reset()
|
||||
|
Reference in New Issue
Block a user