diff --git a/examples/2048/2048.v b/examples/2048/2048.v index 3cac25005a..a94f48de21 100644 --- a/examples/2048/2048.v +++ b/examples/2048/2048.v @@ -910,7 +910,7 @@ fn (mut app App) showfps() { fn main() { mut app := &App{} app.new_game() - mut font_path := os.resource_abs_path(os.join_path('../assets/fonts/', 'RobotoMono-Regular.ttf')) + mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf')) $if android { font_path = 'fonts/RobotoMono-Regular.ttf' } diff --git a/examples/ttf_font/Graduate-Regular.ttf b/examples/assets/fonts/Graduate-Regular.ttf similarity index 100% rename from examples/ttf_font/Graduate-Regular.ttf rename to examples/assets/fonts/Graduate-Regular.ttf diff --git a/examples/ttf_font/Imprima-Regular.ttf b/examples/assets/fonts/Imprima-Regular.ttf similarity index 100% rename from examples/ttf_font/Imprima-Regular.ttf rename to examples/assets/fonts/Imprima-Regular.ttf diff --git a/examples/ttf_font/OFL.txt b/examples/assets/fonts/OFL.txt similarity index 100% rename from examples/ttf_font/OFL.txt rename to examples/assets/fonts/OFL.txt diff --git a/examples/gg/logo.png b/examples/assets/logo.png similarity index 100% rename from examples/gg/logo.png rename to examples/assets/logo.png diff --git a/examples/clock/clock.v b/examples/clock/clock.v index f9ac87b0e4..d80416e7ef 100644 --- a/examples/clock/clock.v +++ b/examples/clock/clock.v @@ -152,7 +152,7 @@ fn on_init(mut app App) { [console] fn main() { println("Press 'q' to quit.") - mut font_path := os.resource_abs_path(os.join_path('../assets/fonts/', 'RobotoMono-Regular.ttf')) + mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf')) $if android { font_path = 'fonts/RobotoMono-Regular.ttf' } diff --git a/examples/fireworks/fireworks.v b/examples/fireworks/fireworks.v index 9581cc54ab..431e39133f 100644 --- a/examples/fireworks/fireworks.v +++ b/examples/fireworks/fireworks.v @@ -96,7 +96,7 @@ fn (mut app App) resize() { // is needed for easier diagnostics on windows [console] fn main() { - mut font_path := os.resource_abs_path(os.join_path('../assets/fonts/', 'RobotoMono-Regular.ttf')) + mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf')) $if android { font_path = 'fonts/RobotoMono-Regular.ttf' } diff --git a/examples/flappylearning/game.v b/examples/flappylearning/game.v index 81f31d81f3..628c256097 100644 --- a/examples/flappylearning/game.v +++ b/examples/flappylearning/game.v @@ -177,7 +177,7 @@ fn main() { mut app := &App{ gg: 0 } - mut font_path := os.resource_abs_path(os.join_path('../assets/fonts/', 'RobotoMono-Regular.ttf')) + mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf')) $if android { font_path = 'fonts/RobotoMono-Regular.ttf' } diff --git a/examples/gg/drag_n_drop.v b/examples/gg/drag_n_drop.v index 9407bf55cb..2529ca0754 100644 --- a/examples/gg/drag_n_drop.v +++ b/examples/gg/drag_n_drop.v @@ -18,7 +18,7 @@ mut: } fn main() { - mut font_path := os.resource_abs_path(os.join_path('../assets/fonts/', 'RobotoMono-Regular.ttf')) + mut font_path := os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'RobotoMono-Regular.ttf')) mut app := &App{ gg: 0 } diff --git a/examples/gg/rectangles.v b/examples/gg/rectangles.v index 73229fd532..5ed630d389 100644 --- a/examples/gg/rectangles.v +++ b/examples/gg/rectangles.v @@ -29,7 +29,8 @@ fn main() { user_data: app init_fn: init_images ) - app.image = app.gg.create_image(os.resource_abs_path('logo.png')) + mut logo_path := os.resource_abs_path(os.join_path('..', 'assets', 'logo.png')) + app.image = app.gg.create_image(logo_path) app.gg.run() } diff --git a/examples/gg/stars.v b/examples/gg/stars.v index 815cfeb341..c909f30187 100644 --- a/examples/gg/stars.v +++ b/examples/gg/stars.v @@ -81,7 +81,8 @@ fn main() { } fn init_images(mut app App) { - app.image = app.gg.create_image(os.resource_abs_path('logo.png')) + mut logo_path := os.resource_abs_path(os.join_path('..', 'assets', 'logo.png')) + app.image = app.gg.create_image(logo_path) } fn frame(mut app App) { diff --git a/examples/sokol/fonts.v b/examples/sokol/fonts.v index 1cf21704c0..7bff6ef87d 100644 --- a/examples/sokol/fonts.v +++ b/examples/sokol/fonts.v @@ -12,6 +12,7 @@ mut: font_normal int } +[console] fn main() { mut color_action := C.sg_color_attachment_action{ action: gfx.Action(C.SG_ACTION_CLEAR) @@ -46,7 +47,9 @@ fn init(mut state AppState) { C.sgl_setup(s) state.fons = sfons.create(512, 512, 1) // or use DroidSerif-Regular.ttf - if bytes := os.read_bytes(os.resource_abs_path('../assets/fonts/RobotoMono-Regular.ttf')) { + if bytes := os.read_bytes(os.resource_abs_path(os.join_path('..', 'assets', 'fonts', + 'RobotoMono-Regular.ttf'))) + { println('loaded font: $bytes.len') state.font_normal = C.fonsAddFontMem(state.fons, c'sans', bytes.data, bytes.len, false) diff --git a/examples/sokol/freetype_raven.v b/examples/sokol/freetype_raven.v index d65b01f411..15699a8b68 100644 --- a/examples/sokol/freetype_raven.v +++ b/examples/sokol/freetype_raven.v @@ -61,6 +61,7 @@ mut: inited bool } +[console] fn main() { mut color_action := C.sg_color_attachment_action{ action: gfx.Action(C.SG_ACTION_CLEAR) @@ -99,7 +100,9 @@ fn init(user_data voidptr) { C.sgl_setup(s) state.fons = sfons.create(512, 512, 1) // or use DroidSerif-Regular.ttf - if bytes := os.read_bytes(os.resource_abs_path('../assets/fonts/RobotoMono-Regular.ttf')) { + if bytes := os.read_bytes(os.resource_abs_path(os.join_path('..', 'assets', 'fonts', + 'RobotoMono-Regular.ttf'))) + { println('loaded font: $bytes.len') state.font_normal = C.fonsAddFontMem(state.fons, c'sans', bytes.data, bytes.len, false) diff --git a/examples/ttf_font/example_ttf.v b/examples/ttf_font/example_ttf.v index e59ef06c08..a80826a01f 100644 --- a/examples/ttf_font/example_ttf.v +++ b/examples/ttf_font/example_ttf.v @@ -11,8 +11,8 @@ const ( win_height = 700 bg_color = gx.white font_paths = [ - os.resource_abs_path('Imprima-Regular.ttf'), - os.resource_abs_path('Graduate-Regular.ttf'), + os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'Imprima-Regular.ttf')), + os.resource_abs_path(os.join_path('..', 'assets', 'fonts', 'Graduate-Regular.ttf')), ] )