diff --git a/Data/Textures/smoochie_resized_25%.txt b/Data/Textures/smoochie_resized_25%.txt index 36119a1..10fac37 100644 --- a/Data/Textures/smoochie_resized_25%.txt +++ b/Data/Textures/smoochie_resized_25%.txt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dab7b6ee92c1a9292570a6938e17a516e053852acf78a2b67926e4b8be024a8b -size 682 +oid sha256:8f4e8c8421191e968407559cf3394cf5f038701a3d01a87bae5867d52aa00363 +size 681 diff --git a/Data/Textures/terry_walk_resized_25%.txt b/Data/Textures/terry_walk_resized_25%.txt index c366089..3eab69a 100644 --- a/Data/Textures/terry_walk_resized_25%.txt +++ b/Data/Textures/terry_walk_resized_25%.txt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d44e76fc63549332f8ea84fb088a06605db25154b43329d244a8a88bd70b731c -size 732 +oid sha256:18ad5298c48d3138a149596920d5d3c321bf62b69a3dc20d7e9cc15477c4fe07 +size 731 diff --git a/build_assets.bat b/build_assets.bat new file mode 100644 index 0000000..c418f83 --- /dev/null +++ b/build_assets.bat @@ -0,0 +1,14 @@ +@echo off +setlocal + +set script_dir_backslash=%~dp0 +set script_dir=%script_dir_backslash:~0,-1% +set sprite_packer=%script_dir%\build\feely_pona_sprite_packer.exe + +if not exist "%sprite_packer%" ( + echo "Sprite packer does not exist at '%sprite_packer%', build the project first" + exit /B 1 +) + +%sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\terry_walk_resized_25%% +%sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\smoochie_resized_25%% diff --git a/feely_pona.cpp b/feely_pona.cpp index 953b80b..9499104 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -407,7 +407,7 @@ void TELY_DLL_Init(void *user_data) sheet->type = TELY_AssetSpriteSheetType_Rects; // NOTE: Load the sprite meta file ========================================================= - Dqn_String8 sheet_name = DQN_STRING8("terry_walk"); + Dqn_String8 sheet_name = DQN_STRING8("terry_walk_resized_25%"); Dqn_String8 sprite_spec_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s.txt", DQN_STRING_FMT(assets->textures_dir), DQN_STRING_FMT(sheet_name)); Dqn_String8 sprite_spec_buffer = platform->func_load_file(scratch.arena, sprite_spec_path); @@ -570,6 +570,7 @@ void TELY_DLL_Init(void *user_data) entity->local_pos = Dqn_V2_InitNx2(1334, 396); entity->sprite_sheet = sheet; entity->sprite_anims = anims; + entity->size_scale = Dqn_V2_InitNx1(0.5f); entity->local_hit_box_size = Dqn_V2_InitV2I(sheet->sprite_size); entity->flags |= FP_GameEntityFlag_Clickable; entity->flags |= FP_GameEntityFlag_MoveByKeyboard; diff --git a/feely_pona_sprite_packer.cpp b/feely_pona_sprite_packer.cpp index 6eae745..c2f40ad 100644 --- a/feely_pona_sprite_packer.cpp +++ b/feely_pona_sprite_packer.cpp @@ -170,13 +170,22 @@ int main(int argc, char const *argv[]) Dqn_String8 atlas_path = Dqn_String8_InitF(scratch.allocator, "%.*s.png", DQN_STRING_FMT(dir)); // NOTE: Generate the meta file ================================================================ + // NOTE: Count the number of animations we loaded frames fore + Dqn_usize num_animations = 0; + for (Dqn_usize index = 1 /*Sentinel*/; index < sprite_spec_table.occupied; index++) { + Dqn_DSMapSlot *slot = sprite_spec_table.slots + index; + if (slot->value.frame_count) { + num_animations++; + } + } + Dqn_String8 meta_path = Dqn_String8_InitF(scratch.allocator, "%.*s.txt", DQN_STRING_FMT(dir)); Dqn_FsFile meta_file = Dqn_Fs_OpenFile(meta_path, Dqn_FsFileOpen_CreateAlways, Dqn_FsFileAccess_Write); Dqn_Fs_WriteFileF(&meta_file, "@file;%.*s;%d;%d\n", DQN_STRING_FMT(Dqn_String8_FileNameFromPath(atlas_path)), DQN_CAST(int) file_list.count, - DQN_CAST(int) sprite_spec_table.occupied - 1); + DQN_CAST(int) num_animations); Dqn_Log_InfoF("Generating meta file: %.*s", DQN_STRING_FMT(meta_path)); Dqn_String8 anim_prefix = {}; diff --git a/project.rdbg b/project.rdbg index 885e462..8d525d5 100644 Binary files a/project.rdbg and b/project.rdbg differ