test-cleancode: check some of the examples too

This commit is contained in:
Delyan Angelov 2021-02-04 17:34:49 +02:00
parent 3e4e0a35e3
commit 32cc95a340
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
8 changed files with 67 additions and 55 deletions

View file

@ -88,11 +88,13 @@ fn event(e &tui.Event, x voidptr) {
}
}
mut app := &App{}
app.tui = tui.init(
user_data: app
frame_fn: frame
event_fn: event
hide_cursor: true
)
app.tui.run() ?
fn main() {
mut app := &App{}
app.tui = tui.init(
user_data: app
frame_fn: frame
event_fn: event
hide_cursor: true
)
app.tui.run() ?
}

View file

@ -31,15 +31,17 @@ fn event(e &tui.Event, x voidptr) {
}
}
mut app := &App{}
app.tui = tui.init(
user_data: app
event_fn: event
window_title: 'V term.ui event viewer'
hide_cursor: true
capture_events: true
frame_rate: 60
use_alternate_buffer: false
)
println('V term.ui event viewer (press `esc` to exit)\n\n')
app.tui.run() ?
fn main() {
mut app := &App{}
app.tui = tui.init(
user_data: app
event_fn: event
window_title: 'V term.ui event viewer'
hide_cursor: true
capture_events: true
frame_rate: 60
use_alternate_buffer: false
)
println('V term.ui event viewer (press `esc` to exit)\n\n')
app.tui.run() ?
}

View file

@ -480,17 +480,18 @@ fn event(e &ui.Event, x voidptr) {
app.event(e)
}
// main
mut app := &App{}
app.tui = ui.init(
user_data: app
init_fn: init
frame_fn: frame
cleanup_fn: cleanup
event_fn: event
fail_fn: fail
capture_events: true
hide_cursor: true
frame_rate: 60
)
app.tui.run() ?
fn main() {
mut app := &App{}
app.tui = ui.init(
user_data: app
init_fn: init
frame_fn: frame
cleanup_fn: cleanup
event_fn: event
fail_fn: fail
capture_events: true
hide_cursor: true
frame_rate: 60
)
app.tui.run() ?
}

View file

@ -84,12 +84,14 @@ fn frame(x voidptr) {
app.redraw = false
}
mut app := &App{}
app.tui = tui.init(
user_data: app
event_fn: event
frame_fn: frame
hide_cursor: true
frame_rate: 60
)
app.tui.run() ?
fn main() {
mut app := &App{}
app.tui = tui.init(
user_data: app
event_fn: event
frame_fn: frame
hide_cursor: true
frame_rate: 60
)
app.tui.run() ?
}

View file

@ -460,13 +460,15 @@ fn (mut a App) draw_gameover() {
a.termui.draw_text(start_x, (a.height / 2) + 3 * block_size, ' ##### # # # # ###### ####### ## ###### # # ')
}
mut app := &App{}
app.termui = termui.init(
user_data: app
event_fn: event
frame_fn: frame
init_fn: init
hide_cursor: true
frame_rate: 10
)
app.termui.run() ?
fn main() {
mut app := &App{}
app.termui = termui.init(
user_data: app
event_fn: event
frame_fn: frame
init_fn: init
hide_cursor: true
frame_rate: 10
)
app.termui.run() ?
}