Update dependencies, refresh README.md, add build scripts for linux(& macos?)

This commit is contained in:
Stefan Stefanov 2026-01-02 15:06:34 +02:00
parent 3f1c523ad9
commit faf42da522
12 changed files with 53 additions and 158 deletions

View file

@ -1,6 +1,6 @@
package generator
import ase "../../vendors/aseprite"
import ase "../../vendors/odin-aseprite"
import "core:encoding/json"
import "core:fmt"
import "core:log"
@ -115,7 +115,7 @@ unmarshall_aseprite_files :: proc(
if extension != ".aseprite" do continue
log.infof("Unmarshalling file: ", file)
ase.unmarshal_from_filename(file, &aseprite_document, alloc)
ase.unmarshal_from_filename(&aseprite_document, file)
atlas_entry := atlas_entry_from_compressed_cells(aseprite_document)
atlas_entry.path = file
@ -147,7 +147,7 @@ atlas_entry_from_compressed_cells :: proc(document: ase.Document) -> (atlas_entr
cell := CellData {
img = rl.Image {
data = rawptr(&cel_img.pixel[0]),
data = rawptr(&cel_img.pixels[0]),
width = auto_cast cel_img.width,
height = auto_cast cel_img.height,
format = .UNCOMPRESSED_R8G8B8A8,
@ -277,7 +277,7 @@ pack_atlas_entries :: proc(
}
cell_metadata := SpriteAtlasMetadata {
name = cell_name,
location = {
location = {
auto_cast rect.x + auto_cast offset_x,
auto_cast rect.y + auto_cast offset_y,
},
@ -290,23 +290,23 @@ pack_atlas_entries :: proc(
}
odin_source_generator_metadata := SourceCodeGeneratorMetadata {
file_defines = {
file_defines = {
top = "package atlas_bindings\n\n",
bottom = "",
file_name = "metadata",
file_extension = ".odin",
},
custom_data_type = {
custom_data_type = {
name = "AtlasRect",
type_declaration = "%v :: struct {{ x, y, w, h: i32 }}\n\n",
},
enum_data = {
enum_data = {
name = "AtlasEnum",
begin_line = "%v :: enum {{\n",
entry_line = "\t%s,\n",
end_line = "}\n\n",
},
array_data = {
array_data = {
name = "ATLAS_SPRITES",
type = "[]AtlasRect",
begin_line = "%v := %v {{\n",
@ -318,23 +318,23 @@ odin_source_generator_metadata := SourceCodeGeneratorMetadata {
cpp_source_generator_metadata := SourceCodeGeneratorMetadata {
file_defines = {
file_defines = {
top = "#include <iostream>\n\n",
bottom = "",
file_name = "metadata",
file_extension = ".hpp",
},
custom_data_type = {
custom_data_type = {
name = "AtlasRect",
type_declaration = "struct %v {{\n\tint x;\n\tint y;\n\tint w;\n\tint h;\n}};\n\n",
},
enum_data = {
enum_data = {
name = "AtlasEnum",
begin_line = "enum %v {{\n",
entry_line = "\t%s,\n",
end_line = "\n\tCOUNT\n}\n\n",
},
array_data = {
array_data = {
name = "ATLAS_SPRITES",
type = "AtlasRect[size_t(AtlasEnum::COUNT)-1]",
begin_line = "{1} {0} = {{\n",
@ -516,7 +516,7 @@ save_metadata_simple :: proc(
return
}
metadata, ok := atlas_metadata.([dynamic]SpriteAtlasMetadata);if !ok {
metadata, ok := atlas_metadata.([dynamic]SpriteAtlasMetadata); if !ok {
log.error("No metadata to export!")
}
@ -542,7 +542,7 @@ save_metadata_simple :: proc(
source_metadata := strings.to_string(sb)
source_output_path := strings.concatenate(
{
{
output_path,
OS_FILE_SEPARATOR,
codegen.file_defines.file_name,
@ -573,7 +573,7 @@ save_metadata :: proc(
atlas_entries: []AtlasEntry,
atlas_metadata: []SpriteAtlasMetadata,
) {
metadata, ok := settings.metadata.(CLIMetadataSettings);if !ok do return
metadata, ok := settings.metadata.(CLIMetadataSettings); if !ok do return
if json_path, ok := metadata.json_path.(string); ok {
json_bytes, jerr := json.marshal(atlas_metadata)