mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-13 01:38:20 +00:00
[client] added support for alert text
This commit is contained in:
parent
86207993b8
commit
b26a535451
@ -60,6 +60,7 @@ typedef LG_RendererOpt * LG_RendererOptions;
|
|||||||
typedef struct LG_RendererParams
|
typedef struct LG_RendererParams
|
||||||
{
|
{
|
||||||
TTF_Font * font;
|
TTF_Font * font;
|
||||||
|
TTF_Font * alertFont;
|
||||||
bool showFPS;
|
bool showFPS;
|
||||||
}
|
}
|
||||||
LG_RendererParams;
|
LG_RendererParams;
|
||||||
|
@ -52,6 +52,7 @@ struct AppState
|
|||||||
bool keyDown[SDL_NUM_SCANCODES];
|
bool keyDown[SDL_NUM_SCANCODES];
|
||||||
|
|
||||||
TTF_Font * font;
|
TTF_Font * font;
|
||||||
|
TTF_Font * alertFont;
|
||||||
SDL_Point srcSize;
|
SDL_Point srcSize;
|
||||||
LG_RendererRect dstRect;
|
LG_RendererRect dstRect;
|
||||||
SDL_Point cursor;
|
SDL_Point cursor;
|
||||||
@ -529,7 +530,7 @@ int eventFilter(void * userdata, SDL_Event * event)
|
|||||||
if (state.lgr)
|
if (state.lgr)
|
||||||
state.lgr->on_alert(
|
state.lgr->on_alert(
|
||||||
state.lgrData,
|
state.lgrData,
|
||||||
LG_ALERT_INFO,
|
serverMode ? LG_ALERT_SUCCESS : LG_ALERT_WARNING,
|
||||||
serverMode ? "Capture Enabled" : "Capture Disabled"
|
serverMode ? "Capture Enabled" : "Capture Disabled"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -716,8 +717,6 @@ int run()
|
|||||||
// SIGINT and the user sending a close event, such as ALT+F4
|
// SIGINT and the user sending a close event, such as ALT+F4
|
||||||
signal(SIGINT, intHandler);
|
signal(SIGINT, intHandler);
|
||||||
|
|
||||||
if (params.showFPS)
|
|
||||||
{
|
|
||||||
if (TTF_Init() < 0)
|
if (TTF_Init() < 0)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("TTL_Init Failed");
|
DEBUG_ERROR("TTL_Init Failed");
|
||||||
@ -746,17 +745,24 @@ int run()
|
|||||||
DEBUG_ERROR("TTL_OpenFont Failed");
|
DEBUG_ERROR("TTL_OpenFont Failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.alertFont = TTF_OpenFont((char *)file, 18);
|
||||||
|
if (!state.alertFont)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("TTL_OpenFont Failed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to locate a font for FPS display");
|
DEBUG_ERROR("Failed to locate a font for text display");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
FcPatternDestroy(pat);
|
FcPatternDestroy(pat);
|
||||||
}
|
|
||||||
|
|
||||||
LG_RendererParams lgrParams;
|
LG_RendererParams lgrParams;
|
||||||
lgrParams.font = state.font;
|
lgrParams.font = state.font;
|
||||||
|
lgrParams.alertFont = state.alertFont;
|
||||||
lgrParams.showFPS = params.showFPS;
|
lgrParams.showFPS = params.showFPS;
|
||||||
Uint32 sdlFlags;
|
Uint32 sdlFlags;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user