Disable CRT by command line #552

This commit is contained in:
BADIM-PC\Vadim 2018-02-27 10:52:43 +03:00
parent cb4076fd3d
commit 57624e3c77
1 changed files with 10 additions and 8 deletions

View File

@ -73,6 +73,11 @@ static struct
} audio; } audio;
} platform; } platform;
static inline bool crtMonitorEnabled()
{
return platform.studio->config()->crtMonitor && platform.gpu.shader;
}
static void initSound() static void initSound()
{ {
SDL_AudioSpec want = SDL_AudioSpec want =
@ -211,7 +216,7 @@ static void calcTextureRect(SDL_Rect* rect)
{ {
SDL_GetWindowSize(platform.window, &rect->w, &rect->h); SDL_GetWindowSize(platform.window, &rect->w, &rect->h);
if(platform.studio->config()->crtMonitor) if(crtMonitorEnabled())
{ {
enum{Width = TIC80_FULLWIDTH, Height = TIC80_FULLHEIGHT}; enum{Width = TIC80_FULLWIDTH, Height = TIC80_FULLHEIGHT};
@ -278,7 +283,7 @@ static void processMouse()
SDL_Rect rect = {0, 0, 0, 0}; SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect); calcTextureRect(&rect);
if(platform.studio->config()->crtMonitor) if(crtMonitorEnabled())
{ {
if(rect.w) input->mouse.x = (mx - rect.x) * TIC80_FULLWIDTH / rect.w - OFFSET_LEFT; if(rect.w) input->mouse.x = (mx - rect.x) * TIC80_FULLWIDTH / rect.w - OFFSET_LEFT;
if(rect.h) input->mouse.y = (my - rect.y) * TIC80_FULLHEIGHT / rect.h - OFFSET_TOP; if(rect.h) input->mouse.y = (my - rect.y) * TIC80_FULLHEIGHT / rect.h - OFFSET_TOP;
@ -1006,9 +1011,7 @@ static void updateConfig()
if(platform.gpu.screen) if(platform.gpu.screen)
{ {
initTouchGamepad(); initTouchGamepad();
loadCrtShader();
if(platform.studio->config()->crtMonitor)
loadCrtShader();
} }
} }
@ -1057,7 +1060,7 @@ static void gpuTick()
GPU_UpdateImageBytes(platform.gpu.texture, NULL, (const u8*)tic->screen, TIC80_FULLWIDTH * sizeof(u32)); GPU_UpdateImageBytes(platform.gpu.texture, NULL, (const u8*)tic->screen, TIC80_FULLWIDTH * sizeof(u32));
{ {
if(platform.studio->config()->crtMonitor && platform.gpu.shader) if(crtMonitorEnabled())
{ {
SDL_Rect rect = {0, 0, 0, 0}; SDL_Rect rect = {0, 0, 0, 0};
calcTextureRect(&rect); calcTextureRect(&rect);
@ -1150,8 +1153,7 @@ static s32 start(s32 argc, char **argv, const char* folder)
GPU_SetAnchor(platform.gpu.texture, 0, 0); GPU_SetAnchor(platform.gpu.texture, 0, 0);
GPU_SetImageFilter(platform.gpu.texture, GPU_FILTER_NEAREST); GPU_SetImageFilter(platform.gpu.texture, GPU_FILTER_NEAREST);
if(platform.studio->config()->crtMonitor) loadCrtShader();
loadCrtShader();
#if defined(__EMSCRIPTEN__) #if defined(__EMSCRIPTEN__)