Skip to content

Commit

Permalink
examples: remove obsolete @[markused] attributes (fixed via V's `-s…
Browse files Browse the repository at this point in the history
…kip-unused` per-default) (#19)
  • Loading branch information
larpon authored Jan 1, 2025
1 parent 2b05337 commit 626e0d0
Show file tree
Hide file tree
Showing 32 changed files with 3 additions and 71 deletions.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* **WIP** Rewrite `shy export` internals
- Exporting to an `AppImage` on Linux now works via `shy export appimage ...`
- Exporting to the Web (via `emcc`) now works via `shy export wasm ...`
* Due to V's switch to using `-skip-unused` per default, `@[markused]` is no longer required
when overriding `init/0`, `fixed_update/1`, `variable_update/1`, `frame/1`, `event/1` and `shutdown/0`
application embedded methods from the `embed` module.

#### Breaking changes

Expand Down
2 changes: 0 additions & 2 deletions examples/anchors/anchors.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mut:
align shy.TextAlign = .baseline | .left
}

@[markused]
pub fn (mut a App) frame(dt f64) {
a.quick.rect(
x: shy.half * a.window.width
Expand Down Expand Up @@ -92,7 +91,6 @@ line 3'
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)

Expand Down
3 changes: 0 additions & 3 deletions examples/anchors/triangle_anchors.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mut:
origin shy.Anchor = .center
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -43,7 +42,6 @@ pub fn (mut a App) init() ! {
}
}

@[markused]
pub fn (mut a App) frame(dt f64) {
center := shy.vec2((shy.half * a.window.width), (shy.half * a.window.height))

Expand Down Expand Up @@ -78,7 +76,6 @@ Rotation: ${rotation * shy.rad2deg:.1f}°'
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)
match e {
Expand Down
2 changes: 0 additions & 2 deletions examples/animation/animators.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ mut:
timer time.StopWatch = time.new_stopwatch()
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -50,7 +49,6 @@ pub fn (mut a App) init() ! {
a.fa_y = a.shy.new_follow_animator[f32](multiply: 1.5)
}

@[markused]
pub fn (mut a App) frame(dt f64) {
mouse := a.mouse
mut text := a.easy.text()
Expand Down
1 change: 0 additions & 1 deletion examples/hello_world/hello_world.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) frame(dt f64) {
a.quick.text(
text: 'Hello Shy World!'
Expand Down
2 changes: 0 additions & 2 deletions examples/image/image.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -25,7 +24,6 @@ pub fn (mut a App) init() ! {
})!
}

@[markused]
pub fn (mut a App) frame(dt f64) {
a.quick.image(
x: shy.half * a.window.width
Expand Down
2 changes: 0 additions & 2 deletions examples/image/image_resize.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -26,7 +25,6 @@ pub fn (mut a App) init() ! {
})!
}

@[markused]
pub fn (mut a App) frame(dt f64) {
a.quick.image(
x: shy.half * a.window.width
Expand Down
2 changes: 0 additions & 2 deletions examples/image_regions/image_regions.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -25,7 +24,6 @@ pub fn (mut a App) init() ! {
})!
}

@[markused]
pub fn (mut a App) frame(dt f64) {
cx := shy.half * a.window.width
cy := shy.half * a.window.height
Expand Down
1 change: 0 additions & 1 deletion examples/mouse/mouse.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) frame(dt f64) {
mx := a.mouse.x
my := a.mouse.y
Expand Down
3 changes: 0 additions & 3 deletions examples/multi_window/multi_window.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!
}

@[markused]
pub fn (mut a App) frame(dt f64) {
mut win := a.shy.active_window()
win_size := win.size()
Expand All @@ -46,7 +44,6 @@ pub fn (mut a App) frame(dt f64) {
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)
match e {
Expand Down
3 changes: 0 additions & 3 deletions examples/particles/simple.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mut:
eps &easy.ParticleSystem = shy.null
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand Down Expand Up @@ -51,12 +50,10 @@ pub fn (mut a App) init() ! {
))
}

@[markused]
pub fn (mut a App) frame(dt f64) {
a.eps.draw()
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)

Expand Down
3 changes: 0 additions & 3 deletions examples/record_and_replay/record_and_replay.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mut:
text string
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand Down Expand Up @@ -57,7 +56,6 @@ pub fn (mut a App) init() ! {
}
}

@[markused]
pub fn (mut a App) frame(dt f64) {
mouse := a.mouse

Expand Down Expand Up @@ -85,7 +83,6 @@ rect.y ${a.fa_y.value}'
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)

Expand Down
3 changes: 0 additions & 3 deletions examples/render_step/render_step.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mut:
a_s &shy.Animator[f32] = shy.null
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!
a.a_r = a.shy.new_animator[f32](
Expand All @@ -44,7 +43,6 @@ pub fn (mut a App) init() ! {
a.window.step(1, 60)
}

@[markused]
pub fn (mut a App) frame(dt f64) {
if !a.a_r.running {
a.a_r.init(-5, 5, 1500)
Expand Down Expand Up @@ -76,7 +74,6 @@ FPS: ${win.fps()}'
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)
match e {
Expand Down
3 changes: 0 additions & 3 deletions examples/render_step/ui_and_manual_mode.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mut:
a_r &shy.Animator[f32] = shy.null
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -35,7 +34,6 @@ pub fn (mut a App) init() ! {
a.window.mode = .ui
}

@[markused]
pub fn (mut a App) frame(dt f64) {
a.quick.rect(
x: shy.half * a.window.width
Expand All @@ -60,7 +58,6 @@ FPS: ${win.fps()}'
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)
a.window.refresh()
Expand Down
1 change: 0 additions & 1 deletion examples/shapes/circle/circle.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) frame(dt f64) {
// Draws a circle at the center of the window
a.quick.circle(
Expand Down
1 change: 0 additions & 1 deletion examples/shapes/lines/lines.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) frame(dt f64) {
win_w := f32(a.window.width)
win_h := f32(a.window.height)
Expand Down
1 change: 0 additions & 1 deletion examples/shapes/rectangle/rectangle.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) frame(dt f64) {
// Draws a square at the center of the window
a.quick.rect(
Expand Down
1 change: 0 additions & 1 deletion examples/shapes/triangle/triangle.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) frame(dt f64) {
center := shy.vec2((shy.half * a.window.width), (shy.half * a.window.height))
half := shy.vec2(f32(50), 50)
Expand Down
1 change: 0 additions & 1 deletion examples/shapes/uniform_polygon/uniform_polygon.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct App {
embed.ExampleApp
}

@[markused]
pub fn (mut a App) frame(dt f64) {
// Draws a hexagon at the center of the window
a.quick.uniform_poly(
Expand Down
3 changes: 0 additions & 3 deletions examples/sound/embedded_sound.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mut:
sound shy.Sound = shy.no_sound
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -33,7 +32,6 @@ pub fn (mut a App) init() ! {
a.sound.play()
}

@[markused]
pub fn (mut a App) frame(dt f64) {
is_looping_str := if a.sound.is_looping() { 'looping' } else { 'not looping' }
is_playing_str := if a.sound.is_playing() {
Expand All @@ -46,7 +44,6 @@ pub fn (mut a App) frame(dt f64) {
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)

Expand Down
3 changes: 0 additions & 3 deletions examples/sound/sound.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ mut:
sound shy.Sound = shy.no_sound
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -30,7 +29,6 @@ pub fn (mut a App) init() ! {
})!
}

@[markused]
pub fn (mut a App) frame(dt f64) {
is_looping_str := if a.sound.is_looping() { 'looping' } else { 'not looping' }
is_playing_str := if a.sound.is_playing() { 'playing' } else { 'not playing' }
Expand All @@ -39,7 +37,6 @@ pub fn (mut a App) frame(dt f64) {
)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)

Expand Down
3 changes: 0 additions & 3 deletions examples/timers/timers.v
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ mut:
since u64
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand Down Expand Up @@ -65,7 +64,6 @@ pub fn (mut a App) init() ! {
}, 1000, shy.infinite)
}

@[markused]
pub fn (mut a App) frame(dt f64) {
size := a.window.size()
a.info_text.x = shy.half * size.width
Expand All @@ -78,7 +76,6 @@ pub fn (mut a App) frame(dt f64) {
a.clock_text.draw()
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)

Expand Down
4 changes: 0 additions & 4 deletions examples/ui/ui.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mut:
ui &ui.UI = shy.null
}

@[markused]
pub fn (mut a App) init() ! {
a.ExampleApp.init()!

Expand All @@ -46,18 +45,15 @@ pub fn (mut a App) init() ! {
)!
}

@[markused]
pub fn (mut a App) update(dt f64) {
a.ui.update()
}

@[markused]
pub fn (mut a App) frame(dt f64) {
// win := a.window
a.ui.draw(dt)
}

@[markused]
pub fn (mut a App) event(e shy.Event) {
a.ExampleApp.event(e)
a.window.refresh() // In case we're running in UI mode signal that we want the screen to be re-drawn on next frame.
Expand Down
Loading

0 comments on commit 626e0d0

Please sign in to comment.