Skip to content

Commit

Permalink
default file name is now name of the work dir
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptmaster committed Dec 28, 2023
1 parent 6b63ca6 commit 01248b0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cli/options.v
Original file line number Diff line number Diff line change
Expand Up @@ -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 <output>] <input>
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 != '' {
Expand Down
33 changes: 33 additions & 0 deletions examples/bezier/app.v
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit 01248b0

Please sign in to comment.