mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
tr2/text: add user scaling
This commit is contained in:
parent
2c344d8639
commit
39ee43b412
6 changed files with 19 additions and 2 deletions
|
@ -9,7 +9,8 @@
|
|||
- added an optional fix for Lara drifting into walls when collecting underwater items (#2096)
|
||||
- added an option to control how music is played while underwater (#1937)
|
||||
- added an optional demo number argument to the `/demo` command
|
||||
- added an option to set the bar scaling (no UI for it yet) (#2149)
|
||||
- added an option to set the bar scaling (no UI for it yet) (#1636)
|
||||
- added an option to set the text scaling (no UI for it yet) (#1636)
|
||||
- changed demo to be interrupted only by esc or action keys
|
||||
- fixed health bar and air bar scaling (#2149)
|
||||
- fixed text being stretched on non-4:3 aspect ratios (#2012)
|
||||
|
|
|
@ -148,6 +148,7 @@ void Config_Sanitize(void)
|
|||
CLAMP(g_Config.rendering.linear_adjustment, 0, 256);
|
||||
|
||||
CLAMP(g_Config.ui.bar_scale, 0.5, 2.0);
|
||||
CLAMP(g_Config.ui.text_scale, 0.5, 2.0);
|
||||
}
|
||||
|
||||
void Config_ApplyChanges(void)
|
||||
|
|
|
@ -23,6 +23,7 @@ typedef struct {
|
|||
} visuals;
|
||||
|
||||
struct {
|
||||
double text_scale;
|
||||
double bar_scale;
|
||||
} ui;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ CFG_INT32(g_Config, gameplay.turbo_speed, 0)
|
|||
CFG_BOOL(g_Config, visuals.enable_3d_pickups, true)
|
||||
CFG_BOOL(g_Config, visuals.enable_fade_effects, true)
|
||||
CFG_BOOL(g_Config, visuals.fix_item_rots, true)
|
||||
CFG_DOUBLE(g_Config, ui.text_scale, 1.0)
|
||||
CFG_DOUBLE(g_Config, ui.bar_scale, 1.0)
|
||||
CFG_ENUM(g_Config, rendering.screenshot_format, SCREENSHOT_FORMAT_JPEG, SCREENSHOT_FORMAT)
|
||||
CFG_ENUM(g_Config, rendering.render_mode, RM_HARDWARE, RENDER_MODE)
|
||||
|
|
|
@ -25,7 +25,8 @@ int32_t Scaler_Calc(const int32_t unit, const SCALER_TARGET target)
|
|||
case SCALER_TARGET_BAR:
|
||||
scale = g_Config.ui.bar_scale;
|
||||
break;
|
||||
default:
|
||||
case SCALER_TARGET_TEXT:
|
||||
scale = g_Config.ui.text_scale;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ typedef struct {
|
|||
int32_t visible_row_offset;
|
||||
int32_t row_count;
|
||||
M_ROW *rows;
|
||||
int32_t listener;
|
||||
} UI_STATS_DIALOG;
|
||||
|
||||
static M_ROW *M_AddRow(
|
||||
|
@ -56,6 +57,7 @@ static void M_AddFinalStatsRows(UI_STATS_DIALOG *self);
|
|||
static void M_AddAssaultCourseStatsRows(UI_STATS_DIALOG *self);
|
||||
static void M_UpdateTimerRow(UI_STATS_DIALOG *self);
|
||||
static void M_DoLayout(UI_STATS_DIALOG *self);
|
||||
static void M_HandleCanvasResize(const EVENT *event, void *data);
|
||||
|
||||
static int32_t M_GetWidth(const UI_STATS_DIALOG *self);
|
||||
static int32_t M_GetHeight(const UI_STATS_DIALOG *self);
|
||||
|
@ -258,6 +260,12 @@ static void M_DoLayout(UI_STATS_DIALOG *const self)
|
|||
(UI_GetCanvasHeight() - M_GetHeight(self)) - 50);
|
||||
}
|
||||
|
||||
static void M_HandleCanvasResize(const EVENT *event, void *data)
|
||||
{
|
||||
UI_STATS_DIALOG *const self = (UI_STATS_DIALOG *)data;
|
||||
M_DoLayout(self);
|
||||
}
|
||||
|
||||
static int32_t M_GetWidth(const UI_STATS_DIALOG *const self)
|
||||
{
|
||||
return self->window->get_width(self->window);
|
||||
|
@ -320,6 +328,7 @@ static void M_Free(UI_STATS_DIALOG *const self)
|
|||
}
|
||||
self->outer_stack->free(self->outer_stack);
|
||||
self->window->free(self->window);
|
||||
UI_Events_Unsubscribe(self->listener);
|
||||
Memory_Free(self);
|
||||
}
|
||||
|
||||
|
@ -343,6 +352,9 @@ UI_WIDGET *UI_StatsDialog_Create(const UI_STATS_DIALOG_MODE mode)
|
|||
|
||||
self->window = UI_Window_Create(self->outer_stack, 8, 8, 8, 8);
|
||||
|
||||
self->listener =
|
||||
UI_Events_Subscribe("canvas_resize", NULL, M_HandleCanvasResize, self);
|
||||
|
||||
switch (mode) {
|
||||
case UI_STATS_DIALOG_MODE_LEVEL:
|
||||
UI_Window_SetTitle(self->window, g_GF_LevelNames[g_CurrentLevel]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue