mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: require calling optfn() ?
/ optfn() or {...}
for fn optfn() ? {}
This commit is contained in:
@ -19,7 +19,7 @@ const (
|
||||
struct App {
|
||||
mut:
|
||||
tui &ui.Context = 0
|
||||
mode Mode = Mode.menu
|
||||
mode Mode = Mode.menu
|
||||
width int
|
||||
height int
|
||||
game &Game = 0
|
||||
@ -35,10 +35,10 @@ fn (mut a App) init() {
|
||||
a.width = w
|
||||
a.height = h
|
||||
term.erase_del_clear()
|
||||
term.set_cursor_position({
|
||||
term.set_cursor_position(
|
||||
x: 0
|
||||
y: 0
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
fn (mut a App) start_game() {
|
||||
@ -66,10 +66,10 @@ fn (mut a App) quit() {
|
||||
a.game.quit()
|
||||
return
|
||||
}
|
||||
term.set_cursor_position({
|
||||
term.set_cursor_position(
|
||||
x: 0
|
||||
y: 0
|
||||
})
|
||||
)
|
||||
exit(0)
|
||||
}
|
||||
|
||||
@ -482,7 +482,7 @@ fn event(e &ui.Event, x voidptr) {
|
||||
|
||||
// main
|
||||
mut app := &App{}
|
||||
app.tui = ui.init({
|
||||
app.tui = ui.init(
|
||||
user_data: app
|
||||
init_fn: init
|
||||
frame_fn: frame
|
||||
@ -492,5 +492,5 @@ app.tui = ui.init({
|
||||
capture_events: true
|
||||
hide_cursor: true
|
||||
frame_rate: 60
|
||||
})
|
||||
app.tui.run()
|
||||
)
|
||||
app.tui.run() ?
|
||||
|
Reference in New Issue
Block a user