diff --git a/cmd/tools/vtest-cleancode.v b/cmd/tools/vtest-cleancode.v index 520b1b5d59..71d7fbfaf3 100644 --- a/cmd/tools/vtest-cleancode.v +++ b/cmd/tools/vtest-cleancode.v @@ -11,6 +11,9 @@ const ( 'vlib/v', 'cmd/v', 'cmd/tools', + 'examples/2048', + 'examples/tetris', + 'examples/term.ui', ] verify_known_failing_exceptions = []string{} vfmt_verify_list = [ diff --git a/examples/2048/2048.v b/examples/2048/2048.v index 16b5718839..5643f8845d 100644 --- a/examples/2048/2048.v +++ b/examples/2048/2048.v @@ -66,7 +66,7 @@ const ( gx.rgb(237, 204, 97), /* 256 */ gx.rgb(237, 200, 80), /* 512 */ gx.rgb(237, 197, 63), /* 1024 */ - gx.rgb(237, 194, 46), /* 2048 */ + gx.rgb(237, 194, 46), ] }, &Theme{ diff --git a/examples/term.ui/cursor_chaser.v b/examples/term.ui/cursor_chaser.v index c8e4545258..dd987e6dba 100644 --- a/examples/term.ui/cursor_chaser.v +++ b/examples/term.ui/cursor_chaser.v @@ -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() ? +} diff --git a/examples/term.ui/event_viewer.v b/examples/term.ui/event_viewer.v index 50dd0bd683..585faabd8f 100644 --- a/examples/term.ui/event_viewer.v +++ b/examples/term.ui/event_viewer.v @@ -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() ? +} diff --git a/examples/term.ui/pong.v b/examples/term.ui/pong.v index 925b9d4fb7..170ac2d1e5 100644 --- a/examples/term.ui/pong.v +++ b/examples/term.ui/pong.v @@ -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() ? +} diff --git a/examples/term.ui/rectangles.v b/examples/term.ui/rectangles.v index d316fee672..9feb9649a9 100644 --- a/examples/term.ui/rectangles.v +++ b/examples/term.ui/rectangles.v @@ -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() ? +} diff --git a/examples/term.ui/vyper.v b/examples/term.ui/vyper.v index 34966f7945..d392dd81a8 100644 --- a/examples/term.ui/vyper.v +++ b/examples/term.ui/vyper.v @@ -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() ? +} diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index befa21d663..dda5926baa 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -61,7 +61,7 @@ const ( 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, 170, 170), ] background_color = gx.white ui_color = gx.rgba(255, 0, 0, 210)