mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 22:01:46 +00:00
[client] imgui: make UI font and size configurable
This commit is contained in:
parent
5d053128ac
commit
436986d182
4 changed files with 20 additions and 3 deletions
|
@ -46,7 +46,6 @@ static inline double util_clamp(double x, double min, double max)
|
|||
return x;
|
||||
}
|
||||
|
||||
#define DEFAULT_FONT_NAME "DejaVu Sans Mono"
|
||||
char * util_getUIFont(const char * fontName);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -262,6 +262,20 @@ static struct Option options[] =
|
|||
.validator = optRotateValidate,
|
||||
.value.x_int = 0,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "uiFont",
|
||||
.description = "The font to use when rendering on-screen UI",
|
||||
.type = OPTION_TYPE_STRING,
|
||||
.value.x_string = "DejaVu Sans Mono",
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "uiSize",
|
||||
.description = "The font size to use when rendering on-screen UI",
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 14
|
||||
},
|
||||
|
||||
// input options
|
||||
{
|
||||
|
@ -526,6 +540,8 @@ bool config_load(int argc, char * argv[])
|
|||
g_params.autoScreensaver = option_get_bool ("win", "autoScreensaver");
|
||||
g_params.showAlerts = option_get_bool ("win", "alerts" );
|
||||
g_params.quickSplash = option_get_bool ("win", "quickSplash" );
|
||||
g_params.uiFont = option_get_string("win" , "uiFont" );
|
||||
g_params.uiSize = option_get_int ("win" , "uiSize" );
|
||||
|
||||
if (g_params.noScreensaver && g_params.autoScreensaver)
|
||||
{
|
||||
|
|
|
@ -191,7 +191,7 @@ static int renderThread(void * unused)
|
|||
|
||||
ImFontAtlas_Clear(g_state.io->Fonts);
|
||||
ImFontAtlas_AddFontFromFileTTF(g_state.io->Fonts, g_state.fontName,
|
||||
14 * g_state.windowScale, NULL, NULL);
|
||||
g_params.uiSize * g_state.windowScale, NULL, NULL);
|
||||
ImFontAtlas_Build(g_state.io->Fonts);
|
||||
|
||||
if (g_state.lgr)
|
||||
|
@ -770,7 +770,7 @@ static int lg_run(void)
|
|||
&text_w, &text_h, NULL);
|
||||
|
||||
g_state.windowScale = 1.0;
|
||||
g_state.fontName = util_getUIFont(DEFAULT_FONT_NAME);
|
||||
g_state.fontName = util_getUIFont(g_params.uiFont);
|
||||
DEBUG_INFO("Using font: %s", g_state.fontName);
|
||||
|
||||
g_state.overlays = ll_new();
|
||||
|
|
|
@ -154,6 +154,8 @@ struct AppParams
|
|||
bool quickSplash;
|
||||
bool alwaysShowCursor;
|
||||
uint64_t helpMenuDelayUs;
|
||||
const char * uiFont;
|
||||
int uiSize;
|
||||
|
||||
unsigned int cursorPollInterval;
|
||||
unsigned int framePollInterval;
|
||||
|
|
Loading…
Reference in a new issue