working highly constrained metadata(ish) source code generator
This commit is contained in:
parent
52364f28b9
commit
99194e943a
5 changed files with 238 additions and 35 deletions
|
|
@ -30,16 +30,32 @@ main :: proc() {
|
|||
target_dir := s.concatenate({cwd, "\\src\\aseprite_odin_generator\\"})
|
||||
|
||||
atlas: rl.Image = rl.GenImageColor(ATLAS_SIZE, ATLAS_SIZE, rl.BLANK)
|
||||
atlas_entries: [dynamic]gen.AtlasEntry
|
||||
atlas_entries: [dynamic]gen.AtlasEntry = make([dynamic]gen.AtlasEntry)
|
||||
gen.unmarshall_aseprite_dir(target_dir, &atlas_entries)
|
||||
|
||||
metadata := gen.pack_atlas_entries(atlas_entries[:], &atlas, 10, 10)
|
||||
|
||||
json_bytes, jerr := json.marshal(metadata)
|
||||
os.write_entire_file("src/aseprite_odin_generator/metadata.json", json_bytes)
|
||||
sb := gen.generate_odin_enums_and_atlas_offsets_file_sb(metadata[:])
|
||||
odin_output_str := s.to_string(sb)
|
||||
os.write_entire_file("src/aseprite_odin_generator/output.odino", transmute([]byte)odin_output_str )
|
||||
os.write_entire_file("src/aseprite_odin_generator/metadata.json", json_bytes)
|
||||
sb := gen.metadata_source_code_generate(metadata[:], gen.odin_source_generator_metadata)
|
||||
odin_output_str := s.to_string(sb)
|
||||
os.write_entire_file(
|
||||
"src/aseprite_odin_generator/output.odino",
|
||||
transmute([]byte)odin_output_str,
|
||||
)
|
||||
|
||||
rl.ExportImage(atlas, EXPORT_PATH)
|
||||
|
||||
// TestStruct :: struct {
|
||||
// something: struct {
|
||||
// name: string,
|
||||
// age: int,
|
||||
// },
|
||||
// }
|
||||
// ts: TestStruct
|
||||
// ts.something.name = "name"
|
||||
|
||||
// jb, err := json.marshal(ts)
|
||||
// sjb := transmute(string)jb
|
||||
// fmt.println(sjb)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue