Added draw package as renderer focused on mixed use layout / 2D / 3D scene applications (#7)
Co-authored-by: Zachary Levy <zachary@sunforge.is> Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
51
meta/main.odin
Normal file
51
meta/main.odin
Normal file
@@ -0,0 +1,51 @@
|
||||
package meta
|
||||
|
||||
import "core:fmt"
|
||||
import "core:os"
|
||||
|
||||
Command :: struct {
|
||||
name: string,
|
||||
description: string,
|
||||
run: proc() -> bool,
|
||||
}
|
||||
|
||||
COMMANDS :: []Command {
|
||||
{
|
||||
name = "gen-shaders",
|
||||
description = "Compile GLSL shaders to SPIR-V and Metal Shading Language.",
|
||||
run = proc() -> bool {
|
||||
return gen_shaders("draw/shaders/source", "draw/shaders/generated")
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
args := os.args[1:]
|
||||
|
||||
if len(args) == 0 {
|
||||
print_usage()
|
||||
return
|
||||
}
|
||||
|
||||
command_name := args[0]
|
||||
for command in COMMANDS {
|
||||
if command.name == command_name {
|
||||
if !command.run() do os.exit(1)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
fmt.eprintfln("Unknown command '%s'.", command_name)
|
||||
fmt.eprintln()
|
||||
print_usage()
|
||||
os.exit(1)
|
||||
}
|
||||
|
||||
print_usage :: proc() {
|
||||
fmt.eprintln("Usage: meta <command>")
|
||||
fmt.eprintln()
|
||||
fmt.eprintln("Commands:")
|
||||
for command in COMMANDS {
|
||||
fmt.eprintfln(" %-20s %s", command.name, command.description)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user