From 01248b0da8fa750c62b77121822e22ebc3fc7528 Mon Sep 17 00:00:00 2001 From: ScriptMaster Date: Thu, 28 Dec 2023 18:26:41 +0530 Subject: [PATCH] default file name is now name of the work dir --- cli/options.v | 8 +++++++- examples/bezier/app.v | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 examples/bezier/app.v diff --git a/cli/options.v b/cli/options.v index 68362c18..5a11f71a 100644 --- a/cli/options.v +++ b/cli/options.v @@ -302,8 +302,14 @@ pub fn (mut opt Options) resolve_output() { output_file = opt.output opt.package_format = output_file_ext // apk / aab } else { // Generate from defaults: vab [-o ] - default_file_name := opt.app_name.replace(os.path_separator.str(), '').replace(' ', + mut default_file_name := '' + if opt.app_name == android.default_app_name { + default_file_name = os.getwd().all_after_last('/').replace(os.path_separator.str(), '').replace(' ', '_').to_lower() + } else { + default_file_name = opt.app_name.replace(os.path_separator.str(), '').replace(' ', + '_').to_lower() + } if opt.output != '' { ext := os.file_ext(opt.output) if ext != '' { diff --git a/examples/bezier/app.v b/examples/bezier/app.v new file mode 100644 index 00000000..b73ad3ef --- /dev/null +++ b/examples/bezier/app.v @@ -0,0 +1,33 @@ +module main + +import gg +import gx + +const points = [f32(200.0), 200.0, 200.0, 100.0, 400.0, 100.0, 400.0, 300.0] + +struct App { +mut: + gg &gg.Context = unsafe { nil } + i u8 +} + +fn main() { + mut app := &App{} + app.gg = gg.new_context( + bg_color: gx.rgb(174, 198, 255) + width: 768 + height: 1024 + window_title: 'Curve' + frame_fn: frame + user_data: app + sample_count: 4 // higher quality curves + ) + app.gg.run() +} + +fn frame(mut app App) { + app.gg.begin() + o := app.i++ % 256 + app.gg.draw_cubic_bezier(points, gx.rgb(o, 255 - o, 255)) + app.gg.end() +}