mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-28 17:46:27 +00:00
[client] imgui: make UI font and size configurable
This commit is contained in:
parent
5d053128ac
commit
436986d182
@ -46,7 +46,6 @@ static inline double util_clamp(double x, double min, double max)
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFAULT_FONT_NAME "DejaVu Sans Mono"
|
|
||||||
char * util_getUIFont(const char * fontName);
|
char * util_getUIFont(const char * fontName);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -262,6 +262,20 @@ static struct Option options[] =
|
|||||||
.validator = optRotateValidate,
|
.validator = optRotateValidate,
|
||||||
.value.x_int = 0,
|
.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
|
// input options
|
||||||
{
|
{
|
||||||
@ -526,6 +540,8 @@ bool config_load(int argc, char * argv[])
|
|||||||
g_params.autoScreensaver = option_get_bool ("win", "autoScreensaver");
|
g_params.autoScreensaver = option_get_bool ("win", "autoScreensaver");
|
||||||
g_params.showAlerts = option_get_bool ("win", "alerts" );
|
g_params.showAlerts = option_get_bool ("win", "alerts" );
|
||||||
g_params.quickSplash = option_get_bool ("win", "quickSplash" );
|
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)
|
if (g_params.noScreensaver && g_params.autoScreensaver)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ static int renderThread(void * unused)
|
|||||||
|
|
||||||
ImFontAtlas_Clear(g_state.io->Fonts);
|
ImFontAtlas_Clear(g_state.io->Fonts);
|
||||||
ImFontAtlas_AddFontFromFileTTF(g_state.io->Fonts, g_state.fontName,
|
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);
|
ImFontAtlas_Build(g_state.io->Fonts);
|
||||||
|
|
||||||
if (g_state.lgr)
|
if (g_state.lgr)
|
||||||
@ -770,7 +770,7 @@ static int lg_run(void)
|
|||||||
&text_w, &text_h, NULL);
|
&text_w, &text_h, NULL);
|
||||||
|
|
||||||
g_state.windowScale = 1.0;
|
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);
|
DEBUG_INFO("Using font: %s", g_state.fontName);
|
||||||
|
|
||||||
g_state.overlays = ll_new();
|
g_state.overlays = ll_new();
|
||||||
|
@ -154,6 +154,8 @@ struct AppParams
|
|||||||
bool quickSplash;
|
bool quickSplash;
|
||||||
bool alwaysShowCursor;
|
bool alwaysShowCursor;
|
||||||
uint64_t helpMenuDelayUs;
|
uint64_t helpMenuDelayUs;
|
||||||
|
const char * uiFont;
|
||||||
|
int uiSize;
|
||||||
|
|
||||||
unsigned int cursorPollInterval;
|
unsigned int cursorPollInterval;
|
||||||
unsigned int framePollInterval;
|
unsigned int framePollInterval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user