this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

added screen Integer Scaling option, enabled by default #1818

nesbox 7ab96aec 2162a313

+37 -18
+1
src/studio/config.c
··· 237 237 .volume = MAX_VOLUME, 238 238 .vsync = true, 239 239 .fullscreen = false, 240 + .integerScaling = true, 240 241 #if defined(BUILD_EDITORS) 241 242 .devmode = false, 242 243 #endif
+20
src/studio/screens/mainmenu.c
··· 109 109 optionFullscreenSet, 110 110 }; 111 111 112 + static s32 optionIntegerScalingGet(void* data) 113 + { 114 + StudioMainMenu* main = data; 115 + return main->options->integerScaling ? 1 : 0; 116 + } 117 + 118 + static void optionIntegerScalingSet(void* data, s32 pos) 119 + { 120 + StudioMainMenu* main = data; 121 + main->options->integerScaling = (pos == 1); 122 + } 123 + 124 + static MenuOption IntegerScalingOption = 125 + { 126 + OPTION_VALUES({OffValue, OnValue}), 127 + optionIntegerScalingGet, 128 + optionIntegerScalingSet, 129 + }; 130 + 112 131 #if defined(CRT_SHADER_SUPPORT) 113 132 static s32 optionCrtMonitorGet(void* data) 114 133 { ··· 217 236 #endif 218 237 {"VSYNC", NULL, &VSyncOption, "VSYNC needs restart!"}, 219 238 {"FULLSCREEN", NULL, &FullscreenOption}, 239 + {"INTEGER SCALING", NULL, &IntegerScalingOption}, 220 240 {"VOLUME", NULL, &VolumeOption}, 221 241 {"SETUP GAMEPAD", showGamepadMenu}, 222 242 {""},
+1
src/studio/system.h
··· 122 122 123 123 bool fullscreen; 124 124 bool vsync; 125 + bool integerScaling; 125 126 s32 volume; 126 127 tic_mapping mapping; 127 128
+15 -18
src/system/sdl/main.c
··· 586 586 #endif 587 587 } 588 588 589 - static void calcTextureRect(SDL_Rect* rect) 589 + static void calcTextureRect(SDL_Rect* rect, bool integer_scale) 590 590 { 591 591 SDL_GetWindowSize(platform.window, &rect->w, &rect->h); 592 592 593 593 enum{Width = TIC80_FULLWIDTH, Height = TIC80_FULLHEIGHT}; 594 594 595 + s32 w, h; 596 + 595 597 if (rect->w * Height < rect->h * Width) 596 598 { 597 - rect->x = rect->y = 0; 598 - rect->h = Height * rect->w / Width; 599 + w = rect->w - (integer_scale ? rect->w % Width : 0); 600 + h = Height * w / Width; 599 601 } 600 602 else 601 603 { 602 - s32 width = Width * rect->h / Height; 604 + h = rect->h - (integer_scale ? rect->h % Height : 0); 605 + w = Width * h / Height; 606 + } 603 607 604 - rect->x = (rect->w - width) / 2; 605 - rect->y = 0; 606 - 607 - rect->w = width; 608 - } 608 + *rect = (SDL_Rect){(rect->w - w) / 2, 0, w, h}; 609 609 } 610 610 611 611 static void processMouse() ··· 629 629 if(platform.mouse.focus) 630 630 { 631 631 SDL_Rect rect; 632 - calcTextureRect(&rect); 632 + calcTextureRect(&rect, studio_config(platform.studio)->options.integerScaling); 633 633 634 634 if(rect.w && rect.h) 635 635 { ··· 1343 1343 #if defined(CRT_SHADER_SUPPORT) 1344 1344 if(!studio_config(platform.studio)->soft) 1345 1345 { 1346 - return GPU_GetFullscreen() ? true : false; 1346 + return GPU_GetFullscreen() == GPU_TRUE ? true : false; 1347 1347 } 1348 1348 else 1349 1349 #endif ··· 1358 1358 #if defined(CRT_SHADER_SUPPORT) 1359 1359 if(!studio_config(platform.studio)->soft) 1360 1360 { 1361 - GPU_SetFullscreen(value ? GPU_TRUE : GPU_FALSE, true); 1361 + GPU_SetFullscreen(value ? GPU_TRUE : GPU_FALSE, GPU_TRUE); 1362 1362 } 1363 1363 else 1364 1364 #endif ··· 1529 1529 renderClear(platform.screen.renderer); 1530 1530 updateTextureBytes(platform.screen.texture, tic->product.screen, TIC80_FULLWIDTH, TIC80_FULLHEIGHT); 1531 1531 1532 + SDL_Rect rect; 1533 + calcTextureRect(&rect, studio_config(platform.studio)->options.integerScaling); 1534 + 1532 1535 #if defined(CRT_SHADER_SUPPORT) 1533 1536 1534 1537 if(!studio_config(platform.studio)->soft && studio_config(platform.studio)->options.crt) 1535 1538 { 1536 1539 if(platform.screen.shader == 0) 1537 1540 loadCrtShader(); 1538 - 1539 - SDL_Rect rect = {0, 0, 0, 0}; 1540 - calcTextureRect(&rect); 1541 1541 1542 1542 GPU_ActivateShaderProgram(platform.screen.shader, &platform.screen.block); 1543 1543 ··· 1562 1562 #endif 1563 1563 1564 1564 { 1565 - SDL_Rect rect = {0, 0, 0, 0}; 1566 - calcTextureRect(&rect); 1567 - 1568 1565 enum {Header = TIC80_OFFSET_TOP, Top = TIC80_OFFSET_TOP, Left = TIC80_OFFSET_LEFT}; 1569 1566 1570 1567 s32 width = 0;