add setting for showing/hiding OSD

This commit is contained in:
Arisotura 2019-06-12 03:32:25 +02:00
parent ea5dc39e83
commit 4553da720c
4 changed files with 27 additions and 0 deletions

View File

@ -28,6 +28,8 @@
#include "OSD.h"
#include "font.h"
#include "PlatformConfig.h"
extern int WindowWidth, WindowHeight;
namespace OSD
@ -306,6 +308,8 @@ void RenderText(u32 color, const char* text, Item* item)
void AddMessage(u32 color, const char* text)
{
if (!Config::ShowOSD) return;
while (Rendering);
Item item;
@ -341,6 +345,14 @@ void WindowResized(bool opengl)
void Update(bool opengl, uiAreaDrawParams* params)
{
if (!Config::ShowOSD)
{
Rendering = true;
if (ItemQueue.size() > 0) DeInit(opengl);
Rendering = false;
return;
}
Rendering = true;
Uint32 tick_now = SDL_GetTicks();

View File

@ -46,6 +46,7 @@ int ScreenUseGL;
int ScreenRatio;
int LimitFPS;
int ShowOSD;
int DirectBoot;
@ -120,6 +121,7 @@ ConfigEntry PlatformConfigFile[] =
{"ScreenRatio", 0, &ScreenRatio, 0, NULL, 0},
{"LimitFPS", 0, &LimitFPS, 1, NULL, 0},
{"ShowOSD", 0, &ShowOSD, 1, NULL, 0},
{"DirectBoot", 0, &DirectBoot, 1, NULL, 0},

View File

@ -57,6 +57,7 @@ extern int ScreenUseGL;
extern int ScreenRatio;
extern int LimitFPS;
extern int ShowOSD;
extern int DirectBoot;

View File

@ -93,6 +93,7 @@ uiMenuItem* MenuItem_ScreenSizing[4];
uiMenuItem* MenuItem_ScreenFilter;
uiMenuItem* MenuItem_LimitFPS;
uiMenuItem* MenuItem_ShowOSD;
SDL_Thread* EmuThread;
int EmuRunning;
@ -2144,6 +2145,13 @@ void OnSetLimitFPS(uiMenuItem* item, uiWindow* window, void* blarg)
else Config::LimitFPS = false;
}
void OnSetShowOSD(uiMenuItem* item, uiWindow* window, void* blarg)
{
int chk = uiMenuItemChecked(item);
if (chk != 0) Config::ShowOSD = true;
else Config::ShowOSD = false;
}
void ApplyNewSettings(int type)
{
if (!RunningSomething)
@ -2370,6 +2378,9 @@ void CreateMainWindowMenu()
MenuItem_LimitFPS = uiMenuAppendCheckItem(menu, "Limit framerate");
uiMenuItemOnClicked(MenuItem_LimitFPS, OnSetLimitFPS, NULL);
MenuItem_ShowOSD = uiMenuAppendCheckItem(menu, "Show OSD");
uiMenuItemOnClicked(MenuItem_ShowOSD, OnSetShowOSD, NULL);
}
void CreateMainWindow(bool opengl)
@ -2604,6 +2615,7 @@ int main(int argc, char** argv)
uiMenuItemSetChecked(MenuItem_ScreenFilter, Config::ScreenFilter==1);
uiMenuItemSetChecked(MenuItem_LimitFPS, Config::LimitFPS==1);
uiMenuItemSetChecked(MenuItem_ShowOSD, Config::ShowOSD==1);
SDL_AudioSpec whatIwant, whatIget;
memset(&whatIwant, 0, sizeof(SDL_AudioSpec));