examples: fix warnings about 0 assignments to reference fields (#21133)

This commit is contained in:
Turiiya 2024-03-29 09:35:37 +01:00 committed by GitHub
parent 1400f649c9
commit 00860ebc6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 9 additions and 30 deletions

View file

@ -172,9 +172,7 @@ fn (mut app App) update() {
}
fn main() {
mut app := &App{
gg: 0
}
mut app := &App{}
mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
$if android {
font_path = 'fonts/RobotoMono-Regular.ttf'

View file

@ -37,7 +37,6 @@ fn frame(mut app App) {
fn main() {
mut app := App{
gg: 0
a: automaton.gun()
}
app.gg = gg.new_context(

View file

@ -17,9 +17,7 @@ mut:
fn main() {
mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
mut app := &App{
gg: 0
}
mut app := &App{}
app.gg = gg.new_context(
bg_color: gx.rgb(174, 198, 255)
width: 600

View file

@ -25,7 +25,6 @@ fn main() {
}
}
mut app := &App{
gg: 0
pixels: pixels
}
app.gg = gg.new_context(

View file

@ -61,9 +61,7 @@ mut:
}
fn main() {
mut app := &App{
gg: 0
}
mut app := &App{}
mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf'))
$if android {
font_path = 'fonts/RobotoMono-Regular.ttf'

View file

@ -14,9 +14,7 @@ mut:
}
fn main() {
mut app := &App{
gg: 0
}
mut app := &App{}
app.gg = gg.new_context(
bg_color: gx.white
width: win_width

View file

@ -43,7 +43,6 @@ mut:
fn main() {
mut app := &App{
gg: 0
stars: []Star{len: max_stars}
v_letters: []VLetter{len: max_v_letters}
}

View file

@ -22,9 +22,7 @@ mut:
}
fn main() {
mut app := &App{
gg: 0
}
mut app := &App{}
app.gg = gg.new_context(
width: win_width
height: win_height

View file

@ -14,9 +14,7 @@ mut:
}
fn main() {
mut context := &Context{
gg: 0
}
mut context := &Context{}
context.gg = gg.new_context(
width: size
height: size

View file

@ -195,9 +195,7 @@ const font = $embed_file('../assets/fonts/RobotoMono-Regular.ttf')
// setup
fn main() {
mut app := App{
gg: 0
}
mut app := App{}
app.reset_game()
app.best.load()

View file

@ -33,9 +33,7 @@ fn my_audio_stream_callback(buffer &f32, num_frames int, num_channels int, mut a
fn main() {
println(credits)
mut state := &AppState{
gg: 0
}
mut state := &AppState{}
audio.setup(
stream_userdata_cb: my_audio_stream_callback
user_data: state

View file

@ -115,9 +115,7 @@ fn my_event_manager(mut ev gg.Event, mut app App_data) {
}
fn main() {
mut app := &App_data{
gg: 0
}
mut app := &App_data{}
app.gg = gg.new_context(
width: win_width
height: win_height