fp: Scale the fonts accordingly to the window rez

This commit is contained in:
doyle 2023-10-22 22:50:18 +11:00
parent 396aea5eb4
commit 98bcb9e56f
2 changed files with 14 additions and 12 deletions

View File

@ -3,16 +3,7 @@
#include "feely_pona_unity.h" #include "feely_pona_unity.h"
#endif #endif
struct FP_ParticleDescriptor Dqn_V2 const FP_TARGET_VIEWPORT_SIZE = Dqn_V2_InitNx2(1824, 1046);
{
Dqn_String8 anim_name;
Dqn_V2 pos;
Dqn_V2 velocity;
Dqn_V2 velocity_variance;
Dqn_V4 colour_begin;
Dqn_V4 colour_end;
Dqn_usize duration_ms;
};
static FP_ParticleDescriptor FP_DefaultFloatUpParticleDescriptor(Dqn_String8 anim_name, Dqn_usize duration_ms) static FP_ParticleDescriptor FP_DefaultFloatUpParticleDescriptor(Dqn_String8 anim_name, Dqn_usize duration_ms)
{ {
@ -398,7 +389,7 @@ static void FP_PlayReset(FP_Game *game, TELY_Platform *platform)
// NOTE: Camera ================================================================================ // NOTE: Camera ================================================================================
play->camera.world_pos = {}; play->camera.world_pos = {};
play->camera.scale = Dqn_V2_InitNx1(1); play->camera.scale = Dqn_V2_InitNx1(1);
play->camera.size = Dqn_V2_InitNx2(1826, 1046); play->camera.size = FP_TARGET_VIEWPORT_SIZE;
} }
#if defined(DQN_OS_WIN32) #if defined(DQN_OS_WIN32)
@ -427,7 +418,8 @@ void TELY_DLL_Init(void *user_data)
TELY_Assets *assets = &platform->assets; TELY_Assets *assets = &platform->assets;
FP_Game *game = Dqn_Arena_New(&platform->arena, FP_Game, Dqn_ZeroMem_Yes); FP_Game *game = Dqn_Arena_New(&platform->arena, FP_Game, Dqn_ZeroMem_Yes);
uint16_t font_size = 18; Dqn_f32 font_scalar = FP_TARGET_VIEWPORT_SIZE.w / DQN_CAST(Dqn_f32)platform->core.window_size.x;
uint16_t font_size = DQN_CAST(uint16_t)(18 * font_scalar);
game->inter_regular_font_large = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Fonts/Inter-Regular.otf"), DQN_CAST(uint16_t)(font_size * 5.f)); game->inter_regular_font_large = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Fonts/Inter-Regular.otf"), DQN_CAST(uint16_t)(font_size * 5.f));
game->inter_regular_font = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Fonts/Inter-Regular.otf"), DQN_CAST(uint16_t)(font_size)); game->inter_regular_font = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Fonts/Inter-Regular.otf"), DQN_CAST(uint16_t)(font_size));
game->inter_italic_font = platform->func_load_font(assets, DQN_STRING8("Inter (Italic)"), DQN_STRING8("Data/Fonts/Inter-Italic.otf"), font_size); game->inter_italic_font = platform->func_load_font(assets, DQN_STRING8("Inter (Italic)"), DQN_STRING8("Data/Fonts/Inter-Italic.otf"), font_size);

View File

@ -153,6 +153,16 @@ struct FP_GlobalAnimations
} }
g_anim_names; g_anim_names;
struct FP_ParticleDescriptor
{
Dqn_String8 anim_name;
Dqn_V2 pos;
Dqn_V2 velocity;
Dqn_V2 velocity_variance;
Dqn_V4 colour_begin;
Dqn_V4 colour_end;
Dqn_usize duration_ms;
};
#if defined(DQN_PLATFORM_EMSCRIPTEN) #if defined(DQN_PLATFORM_EMSCRIPTEN)
#define FP_DEVELOPER_MODE 0 #define FP_DEVELOPER_MODE 0