this repo has no description
0
fork

Configure Feed

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

Fix f1 hotkey conflict (#2646)

* fix f1 hotkey conflict

* use f7 as it doesn't conflict

* fix f1 hotkey conflict

authored by

Miguel and committed by
GitHub
048df326 55ee0b30

+34 -2
+7 -1
src/studio/editors/code.c
··· 2957 2957 } 2958 2958 2959 2959 bool usedKeybinding = true; 2960 - 2960 + 2961 + if(hasJustSwitchedToCodeMode(code->studio)) 2962 + { 2963 + setJustSwitchedToCodeMode(code->studio, false); 2964 + return; // Skip processing other inputs for this frame 2965 + } 2966 + 2961 2967 // handle bookmarks 2962 2968 if(keyWasPressed(code->studio, tic_key_f1)) 2963 2969 {
+25 -1
src/studio/studio.c
··· 1772 1772 } 1773 1773 1774 1774 #if defined(BUILD_EDITORS) 1775 + // These three are to fix the f1 hotkey conflict 1776 + 1777 + // Add a static variable in studio.c to track the mode switch 1778 + static bool justSwitchedToCodeMode = false; 1779 + 1780 + void setJustSwitchedToCodeMode(Studio* studio, bool value) 1781 + { 1782 + justSwitchedToCodeMode = value; 1783 + } 1784 + 1785 + bool hasJustSwitchedToCodeMode(Studio* studio) 1786 + { 1787 + return justSwitchedToCodeMode; 1788 + } 1789 + #endif 1790 + 1791 + #if defined(BUILD_EDITORS) 1775 1792 1776 1793 static bool showGameMenu(Studio* studio) 1777 1794 { ··· 1890 1907 1891 1908 if(!showGameMenu(studio) || studio->mode != TIC_RUN_MODE) 1892 1909 { 1893 - if(keyWasPressedOnce(studio, tic_key_f1)) setStudioMode(studio, TIC_CODE_MODE); 1910 + if(keyWasPressedOnce(studio, tic_key_f1)) 1911 + { 1912 + if(studio->mode != TIC_CODE_MODE) 1913 + { 1914 + setStudioMode(studio, TIC_CODE_MODE); 1915 + setJustSwitchedToCodeMode(studio, true); 1916 + } 1917 + } 1894 1918 else if(keyWasPressedOnce(studio, tic_key_f2)) setStudioMode(studio, TIC_SPRITE_MODE); 1895 1919 else if(keyWasPressedOnce(studio, tic_key_f3)) setStudioMode(studio, TIC_MAP_MODE); 1896 1920 else if(keyWasPressedOnce(studio, tic_key_f4)) setStudioMode(studio, TIC_SFX_MODE);
+2
src/studio/system.h
··· 156 156 157 157 typedef struct Studio Studio; 158 158 159 + void setJustSwitchedToCodeMode(Studio* studio, bool value); 160 + bool hasJustSwitchedToCodeMode(Studio* studio); 159 161 const tic_mem* studio_mem(Studio* studio); 160 162 void studio_tick(Studio* studio, tic80_input input); 161 163 void studio_sound(Studio* studio);