-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.odin
63 lines (53 loc) · 1.32 KB
/
main.odin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import "core:os"
import "core:fmt"
import "gui"
VERSION :: "version 1"
FONT_DATA :: #load("fonts/Inter/Inter-Regular.ttf")
usage :: proc(programName: string) {
fmt.println("Usage:", programName, "[OPTIONS] [.ARW file]")
fmt.println("Preview Sony a6000 .ARW files")
fmt.println("")
fmt.println(" --close-on-first-frame close on first frame drawn (startup profiling purposes)")
fmt.println(" --verbose output debug information")
fmt.println(" -v, --version output version information and exit")
fmt.println(" -h, --help display this help and exit")
}
main :: proc() {
if len(os.args) < 2 {
usage(os.args[0])
os.exit(0)
}
guiArgs: gui.Args
version := false
help := false
for i := 1; i < len(os.args); i += 1 {
arg := os.args[i]
if arg == "-v" || arg == "--version" {
version = true
} else if arg == "-h" || arg == "--help" {
help = true
} else if arg == "--verbose" {
guiArgs.verbose = true
} else if arg == "--close-on-first-frame" {
guiArgs.closeOnFirstFrame = true
} else {
guiArgs.filename = arg
}
}
if help {
usage(os.args[0])
os.exit(0)
}
if version {
fmt.println("arw-preview2", VERSION)
os.exit(0)
}
if guiArgs.filename == "" {
usage(os.args[0])
os.exit(0)
}
theGui: gui.Gui
exitCode := gui.run(&theGui, FONT_DATA, guiArgs)
os.exit(exitCode)
}