this repo has no description
0
fork

Configure Feed

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

build fix and some optimizations for the Integer Scale option #1818

nesbox a1f80a22 7ab96aec

+30 -25
+6 -6
src/studio/config.c
··· 232 232 .options = 233 233 { 234 234 #if defined(CRT_SHADER_SUPPORT) 235 - .crt = false, 235 + .crt = false, 236 236 #endif 237 - .volume = MAX_VOLUME, 238 - .vsync = true, 239 - .fullscreen = false, 240 - .integerScaling = true, 237 + .volume = MAX_VOLUME, 238 + .vsync = true, 239 + .fullscreen = false, 240 + .integerScale = true, 241 241 #if defined(BUILD_EDITORS) 242 - .devmode = false, 242 + .devmode = false, 243 243 #endif 244 244 }, 245 245 };
+8 -8
src/studio/screens/mainmenu.c
··· 109 109 optionFullscreenSet, 110 110 }; 111 111 112 - static s32 optionIntegerScalingGet(void* data) 112 + static s32 optionIntegerScaleGet(void* data) 113 113 { 114 114 StudioMainMenu* main = data; 115 - return main->options->integerScaling ? 1 : 0; 115 + return main->options->integerScale ? 1 : 0; 116 116 } 117 117 118 - static void optionIntegerScalingSet(void* data, s32 pos) 118 + static void optionIntegerScaleSet(void* data, s32 pos) 119 119 { 120 120 StudioMainMenu* main = data; 121 - main->options->integerScaling = (pos == 1); 121 + main->options->integerScale = (pos == 1); 122 122 } 123 123 124 - static MenuOption IntegerScalingOption = 124 + static MenuOption IntegerScaleOption = 125 125 { 126 126 OPTION_VALUES({OffValue, OnValue}), 127 - optionIntegerScalingGet, 128 - optionIntegerScalingSet, 127 + optionIntegerScaleGet, 128 + optionIntegerScaleSet, 129 129 }; 130 130 131 131 #if defined(CRT_SHADER_SUPPORT) ··· 236 236 #endif 237 237 {"VSYNC", NULL, &VSyncOption, "VSYNC needs restart!"}, 238 238 {"FULLSCREEN", NULL, &FullscreenOption}, 239 - {"INTEGER SCALING", NULL, &IntegerScalingOption}, 239 + {"INTEGER SCALE", NULL, &IntegerScaleOption}, 240 240 {"VOLUME", NULL, &VolumeOption}, 241 241 {"SETUP GAMEPAD", showGamepadMenu}, 242 242 {""},
+7 -2
src/studio/studio.c
··· 1621 1621 return tic_api_keyp(tic, key, -1, -1); 1622 1622 } 1623 1623 1624 + static void gotoFullscreen(Studio* studio) 1625 + { 1626 + tic_sys_fullscreen_set(studio->config->data.options.fullscreen = !tic_sys_fullscreen_get()); 1627 + } 1628 + 1624 1629 #if defined(CRT_SHADER_SUPPORT) 1625 1630 static void switchCrtMonitor(Studio* studio) 1626 1631 { ··· 1677 1682 1678 1683 if(alt) 1679 1684 { 1680 - if (keyWasPressedOnce(studio, tic_key_return)) tic_sys_fullscreen_set(!tic_sys_fullscreen_get()); 1685 + if (keyWasPressedOnce(studio, tic_key_return)) gotoFullscreen(studio); 1681 1686 #if defined(BUILD_EDITORS) 1682 1687 else if(studio->mode != TIC_RUN_MODE) 1683 1688 { ··· 1713 1718 } 1714 1719 else 1715 1720 { 1716 - if (keyWasPressedOnce(studio, tic_key_f11)) tic_sys_fullscreen_set(!tic_sys_fullscreen_get()); 1721 + if (keyWasPressedOnce(studio, tic_key_f11)) gotoFullscreen(studio); 1717 1722 #if defined(BUILD_EDITORS) 1718 1723 else if(keyWasPressedOnce(studio, tic_key_escape)) 1719 1724 {
+1 -1
src/studio/system.h
··· 122 122 123 123 bool fullscreen; 124 124 bool vsync; 125 - bool integerScaling; 125 + bool integerScale; 126 126 s32 volume; 127 127 tic_mapping mapping; 128 128
+8 -8
src/system/sdl/main.c
··· 586 586 #endif 587 587 } 588 588 589 - static void calcTextureRect(SDL_Rect* rect, bool integer_scale) 589 + static void calcTextureRect(SDL_Rect* rect) 590 590 { 591 + bool integerScale = studio_config(platform.studio)->options.integerScale; 592 + 591 593 SDL_GetWindowSize(platform.window, &rect->w, &rect->h); 592 594 593 595 enum{Width = TIC80_FULLWIDTH, Height = TIC80_FULLHEIGHT}; ··· 596 598 597 599 if (rect->w * Height < rect->h * Width) 598 600 { 599 - w = rect->w - (integer_scale ? rect->w % Width : 0); 601 + w = rect->w - (integerScale ? rect->w % Width : 0); 600 602 h = Height * w / Width; 601 603 } 602 604 else 603 605 { 604 - h = rect->h - (integer_scale ? rect->h % Height : 0); 606 + h = rect->h - (integerScale ? rect->h % Height : 0); 605 607 w = Width * h / Height; 606 608 } 607 609 ··· 629 631 if(platform.mouse.focus) 630 632 { 631 633 SDL_Rect rect; 632 - calcTextureRect(&rect, studio_config(platform.studio)->options.integerScaling); 634 + calcTextureRect(&rect); 633 635 634 636 if(rect.w && rect.h) 635 637 { ··· 741 743 SDL_Rect rect; 742 744 calcTextureRect(&rect); 743 745 744 - float scale = (float)w / (KBD_COLS*TIC_SPRITESIZE); 745 - 746 - return h - KBD_ROWS*TIC_SPRITESIZE*scale - (rect.h + rect.y*2) >= 0 && !SDL_IsTextInputActive(); 746 + return h - rect.h - KBD_ROWS * w / KBD_COLS >= 0 && !SDL_IsTextInputActive(); 747 747 } 748 748 749 749 static const tic_key KbdLayout[] = ··· 1530 1530 updateTextureBytes(platform.screen.texture, tic->product.screen, TIC80_FULLWIDTH, TIC80_FULLHEIGHT); 1531 1531 1532 1532 SDL_Rect rect; 1533 - calcTextureRect(&rect, studio_config(platform.studio)->options.integerScaling); 1533 + calcTextureRect(&rect); 1534 1534 1535 1535 #if defined(CRT_SHADER_SUPPORT) 1536 1536