tely/asset: Fix sprite packer emitting wrong anim count
This commit is contained in:
parent
aa75118996
commit
bb89100130
BIN
Data/Textures/smoochie_resized_25%.txt
(Stored with Git LFS)
BIN
Data/Textures/smoochie_resized_25%.txt
(Stored with Git LFS)
Binary file not shown.
BIN
Data/Textures/terry_walk_resized_25%.txt
(Stored with Git LFS)
BIN
Data/Textures/terry_walk_resized_25%.txt
(Stored with Git LFS)
Binary file not shown.
14
build_assets.bat
Normal file
14
build_assets.bat
Normal file
@ -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%%
|
@ -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;
|
||||
|
@ -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<SpriteSpecification> *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 = {};
|
||||
|
BIN
project.rdbg
BIN
project.rdbg
Binary file not shown.
Loading…
Reference in New Issue
Block a user