Compare commits
4 Commits
eb90d7dbfa
...
7e9ad29be3
Author | SHA1 | Date | |
---|---|---|---|
7e9ad29be3 | |||
ab9f0df551 | |||
b19c838e8a | |||
403051e540 |
BIN
Data/Audio/terry_hit.ogg
(Stored with Git LFS)
Normal file
BIN
Data/Audio/terry_hit.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
2
External/tely
vendored
2
External/tely
vendored
@ -1 +1 @@
|
|||||||
Subproject commit f4390f0a385345efc07297317539d5eb6e8c9c09
|
Subproject commit 63cd4aa4a04ec3adadf9778bd01d7e2a2ba04794
|
@ -365,12 +365,13 @@ void TELY_DLL_Init(void *user_data)
|
|||||||
FP_Game_PopParentEntity(game);
|
FP_Game_PopParentEntity(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t font_size = 18;
|
uint16_t font_size = 18;
|
||||||
game->camera.scale = Dqn_V2_InitNx1(1);
|
game->camera.scale = Dqn_V2_InitNx1(1);
|
||||||
game->inter_regular_font = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Inter-Regular.otf"), font_size);
|
game->inter_regular_font = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Inter-Regular.otf"), font_size);
|
||||||
game->inter_italic_font = platform->func_load_font(assets, DQN_STRING8("Inter (Italic)"), DQN_STRING8("Data/Inter-Italic.otf"), font_size);
|
game->inter_italic_font = platform->func_load_font(assets, DQN_STRING8("Inter (Italic)"), DQN_STRING8("Data/Inter-Italic.otf"), font_size);
|
||||||
game->jetbrains_mono_font = platform->func_load_font(assets, DQN_STRING8("JetBrains Mono NL (Regular)"), DQN_STRING8("Data/JetBrainsMonoNL-Regular.ttf"), font_size);
|
game->jetbrains_mono_font = platform->func_load_font(assets, DQN_STRING8("JetBrains Mono NL (Regular)"), DQN_STRING8("Data/JetBrainsMonoNL-Regular.ttf"), font_size);
|
||||||
game->test_audio = platform->func_load_audio(assets, DQN_STRING8("Test Audio"), DQN_STRING8("Data/Audio/Purrple Cat - Moonwinds.qoa"));
|
game->audio[FP_GameAudio_TestAudio] = platform->func_load_audio(assets, DQN_STRING8("Test Audio"), DQN_STRING8("Data/Audio/Purrple Cat - Moonwinds.qoa"));
|
||||||
|
game->audio[FP_GameAudio_TerryHit] = platform->func_load_audio(assets, DQN_STRING8("Terry Hit"), DQN_STRING8("Data/Audio/terry_hit.ogg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FP_EntityActionStateMachine(FP_Game *game, TELY_PlatformInput *input, FP_GameEntity *entity, Dqn_V2 dir_vector)
|
void FP_EntityActionStateMachine(FP_Game *game, TELY_PlatformInput *input, FP_GameEntity *entity, Dqn_V2 dir_vector)
|
||||||
@ -505,6 +506,7 @@ void FP_EntityActionStateMachine(FP_Game *game, TELY_PlatformInput *input, FP_Ga
|
|||||||
if (!entity->attack_processed && game->clock_ms >= midpoint_clock_ms) {
|
if (!entity->attack_processed && game->clock_ms >= midpoint_clock_ms) {
|
||||||
entity->attack_box_size = entity->local_hit_box_size;
|
entity->attack_box_size = entity->local_hit_box_size;
|
||||||
|
|
||||||
|
FP_EnqueueSound(game, game->audio[FP_GameAudio_TerryHit], 1.0f);
|
||||||
// NOTE: Position the attack box
|
// NOTE: Position the attack box
|
||||||
switch (entity->direction) {
|
switch (entity->direction) {
|
||||||
case FP_GameDirection_Left: {
|
case FP_GameDirection_Left: {
|
||||||
@ -1364,7 +1366,6 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dqn_Profiler_EndZone(update_zone);
|
Dqn_Profiler_EndZone(update_zone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer)
|
void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer)
|
||||||
@ -1628,10 +1629,23 @@ void TELY_DLL_FrameUpdate(void *user_data)
|
|||||||
// =============================================================================================
|
// =============================================================================================
|
||||||
|
|
||||||
TELY_Audio *audio = &platform->audio;
|
TELY_Audio *audio = &platform->audio;
|
||||||
if (audio->playback_size == 0) {
|
|
||||||
TELY_Audio_Play(audio, game->test_audio, 1.f /*volume*/);
|
// NOTE: Process the sound command queue
|
||||||
|
for (uint32_t i = 0; i < game->sound_command_count; i++)
|
||||||
|
{
|
||||||
|
FP_SoundCommand *sound_command = &game->sound_commands[i];
|
||||||
|
TELY_Audio_Play(audio, sound_command->audio_handle, sound_command->volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Clear the sound command queue for the next frame
|
||||||
|
game->sound_command_count = 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (audio->playback_size == 0) {
|
||||||
|
TELY_Audio_Play(audio, game->audio[FP_GameAudio_TestAudio], 1.f /*volume*/);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// =============================================================================================
|
// =============================================================================================
|
||||||
|
|
||||||
if (TELY_Platform_InputKeyWasDown(input->mouse_left) && TELY_Platform_InputKeyIsDown(input->mouse_left)) {
|
if (TELY_Platform_InputKeyWasDown(input->mouse_left) && TELY_Platform_InputKeyIsDown(input->mouse_left)) {
|
||||||
@ -1747,5 +1761,5 @@ void TELY_DLL_FrameUpdate(void *user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TELY_RFui_Flush(rfui, renderer, input, assets);
|
TELY_RFui_Flush(rfui, renderer, input, assets);
|
||||||
//TELY_Audio_MixPlaybackSamples(audio, assets);
|
TELY_Audio_MixPlaybackSamples(audio, assets);
|
||||||
}
|
}
|
||||||
|
@ -716,3 +716,10 @@ FP_GameFindClosestEntityResult FP_Game_FindClosestEntityWithType(FP_Game *game,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void FP_EnqueueSound(FP_Game *game, TELY_AssetAudioHandle audio_handle, Dqn_f32 volume)
|
||||||
|
{
|
||||||
|
DQN_ASSERT(game->sound_command_count < MAX_SOUNDS);
|
||||||
|
FP_SoundCommand *sound_command = &game->sound_commands[game->sound_command_count++];
|
||||||
|
sound_command->audio_handle = audio_handle;
|
||||||
|
sound_command->volume = volume;
|
||||||
|
}
|
||||||
|
@ -201,6 +201,20 @@ struct FP_GameCamera
|
|||||||
Dqn_V2 scale;
|
Dqn_V2 scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum FP_GameAudio
|
||||||
|
{
|
||||||
|
FP_GameAudio_TestAudio,
|
||||||
|
FP_GameAudio_TerryHit,
|
||||||
|
FP_GameAudio_Count,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FP_SoundCommand
|
||||||
|
{
|
||||||
|
TELY_AssetAudioHandle audio_handle;
|
||||||
|
float volume;
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint32_t MAX_SOUNDS = 128;
|
||||||
struct FP_Game
|
struct FP_Game
|
||||||
{
|
{
|
||||||
Dqn_f32 delta_s_accumulator;
|
Dqn_f32 delta_s_accumulator;
|
||||||
@ -209,7 +223,11 @@ struct FP_Game
|
|||||||
TELY_AssetFontHandle inter_regular_font;
|
TELY_AssetFontHandle inter_regular_font;
|
||||||
TELY_AssetFontHandle inter_italic_font;
|
TELY_AssetFontHandle inter_italic_font;
|
||||||
TELY_AssetFontHandle jetbrains_mono_font;
|
TELY_AssetFontHandle jetbrains_mono_font;
|
||||||
TELY_AssetAudioHandle test_audio;
|
TELY_AssetAudioHandle audio[FP_GameAudio_Count];
|
||||||
|
|
||||||
|
FP_SoundCommand sound_commands[MAX_SOUNDS];
|
||||||
|
uint32_t sound_command_count;
|
||||||
|
|
||||||
Dqn_Slice<TELY_AssetSpriteAnimation> hero_sprite_anims;
|
Dqn_Slice<TELY_AssetSpriteAnimation> hero_sprite_anims;
|
||||||
TELY_AssetSpriteSheet hero_sprite_sheet;
|
TELY_AssetSpriteSheet hero_sprite_sheet;
|
||||||
Dqn_FArray<FP_GameEntityHandle, 8> parent_entity_stack;
|
Dqn_FArray<FP_GameEntityHandle, 8> parent_entity_stack;
|
||||||
|
Loading…
Reference in New Issue
Block a user