this repo has no description
0
fork

Configure Feed

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

Update console.c (#2594)

Add hotkeys topic to help command

authored by

Skeptim and committed by
GitHub
80657bd4 0602a612

+240 -1
+240 -1
src/studio/screens/console.c
··· 77 77 macro(keys) \ 78 78 macro(buttons) \ 79 79 macro(startup) \ 80 + macro(hotkeys) \ 80 81 macro(terms) \ 81 82 macro(license) 82 83 ··· 125 126 macro(vbank) \ 126 127 macro(id) \ 127 128 ALONE_KEY(macro) 128 - 129 + 129 130 static const char* WelcomeText = 130 131 "TIC-80 is a fantasy computer for making, playing and sharing tiny games.\n\n" 131 132 "It has built-in tools for development: code, sprites, maps, sound editors and the command line, " ··· 143 144 {"MAP", "240x136 cells, 1920x1088 pixels."}, 144 145 {"SOUND", "4 channels with configurable waveforms."}, 145 146 {"CODE", "64KB of $LANG_NAMES$.", 147 + }, 148 + }; 149 + 150 + static const struct HotkeysRowGeneral {const char* section; const char* info;} HotkeysTextGeneral[] = 151 + { 152 + {"CTRL+R/ENTER", "Run current project."}, 153 + {"CTRL+S", "Save cart."}, 154 + {"CTRL+X/C/V", "Cut/copy/paste in the editors."}, 155 + {"CTRL+Z/Y", "Undo/redo changes in the editors."}, 156 + {"F6", "Toggle CRT filter."}, 157 + {"F7", "Assign cover image while in game."}, 158 + {"F8", "Take a screenshot."}, 159 + {"F9", "Start/stop GIF video recording."}, 160 + {"F11/ALT+ENTER", "Fullscreen/window mode."}, 161 + {"CTRL+Q", "Quit the application.", 162 + }, 163 + }; 164 + 165 + static const struct HotkeysRowNavigation {const char* section; const char* info;} HotkeysTextNavigation[] = 166 + { 167 + {"ESC", "Switch console/editor or open menu while in game."}, 168 + {"ESC+F1", "Switch to code editor while in game."}, 169 + {"ALT+~", "Show console."}, 170 + {"ALT+1/F1", "Show code editor."}, 171 + {"ALT+2/F2", "Show sprite editor."}, 172 + {"ALT+3/F3", "Show map editor."}, 173 + {"ALT+4/F4", "Show sfx editor."}, 174 + {"ALT+5/F5", "Show music editor."}, 175 + {"CTRL+PGUP/PGDOWN", "Switch to previous/next editor mode.", 176 + }, 177 + }; 178 + 179 + static const struct HotkeysRowCodeEditor {const char* section; const char* info;} HotkeysTextCodeEditor[] = 180 + { 181 + {"CTRL+F", "Find."}, 182 + {"CTRL+G", "Go to line."}, 183 + {"CTRL+P/N", "Move to previous/next line."}, 184 + {"ALT/CTRL+LEFT", "Move to previous word."}, 185 + {"ALT/CTRL+RIGHT", "Move to next word."}, 186 + {"ALT/CTRL+BACKSPACE", "Delete previous word."}, 187 + {"ALT/CTRL+DELETE", "Delete next word."}, 188 + {"CTRL+K", "Delete end of line."}, 189 + {"CTRL+D", "Duplicate current line."}, 190 + {"CTRL+J", "Newline."}, 191 + {"CTRL+A", "Select all."}, 192 + {"CTRL+F1", "Bookmark current line."}, 193 + {"F1", "Move to next bookmark."}, 194 + {"CTRL+B", "Show bookmark list."}, 195 + {"CTRL+O", "Show code outline and navigate functions."}, 196 + {"CTRL+TAB", "Indent line."}, 197 + {"CTRL+SHIFT+TAB", "Unindent line."}, 198 + {"CTRL+/", "Comment/Uncomment line."}, 199 + {"RIGHT CLICK", "Drag."}, 200 + {"SCROLL WHEEL", "Vertical scrolling."}, 201 + {"SHIFT+SCROLL WHEEL", "Horizontal scrolling."}, 202 + {"CTRL+L", "Center screen on cursor.", 203 + }, 204 + }; 205 + 206 + static const struct HotkeysRowSpriteEditor {const char* section; const char* info;} HotkeysTextSpriteEditor[] = 207 + { 208 + {"TAB", "Switch tiles/sprites."}, 209 + {"[]", "Choose previous/next palette color."}, 210 + {"-/=", "Change brush size."}, 211 + {"SCROLL", "Canvas zoom."}, 212 + {"1", "Select brush."}, 213 + {"2", "Select color picker."}, 214 + {"3", "Select selection tool."}, 215 + {"4", "Select filling tool."}, 216 + {"5", "Flip horizontally."}, 217 + {"6", "Flip vertically."}, 218 + {"7", "Rotate."}, 219 + {"8/DELETE", "Erase.", 220 + }, 221 + }; 222 + 223 + static const struct HotkeysRowMapEditor {const char* section; const char* info;} HotkeysTextMapEditor[] = 224 + { 225 + {"SHIFT", "Show tilesheet."}, 226 + {"CTRL+CLICK", "Replace all identical tiles (when the Fill tool [4] is selected)."}, 227 + {"`", "Show/hide grid."}, 228 + {"TAB/SCROLL", "Switch to full world map."}, 229 + {"1", "Select draw."}, 230 + {"2", "Select drag map."}, 231 + {"3", "Select selection tool."}, 232 + {"4", "Select filling tool.", 233 + }, 234 + }; 235 + 236 + static const struct HotkeysRowSFXEditor {const char* section; const char* info;} HotkeysTextSFXEditor[] = 237 + { 238 + {"SPACE", "Play last played note."}, 239 + {"Z,X,C,V,B,N,M", "Play notes corresponding to one octave (bottom row of QWERTY layout)."}, 240 + {"S,D,G,H,J", "Play notes corresponding to sharps and flats (home row of QWERTY layout).", 241 + }, 242 + }; 243 + 244 + static const struct HotkeysRowMusicEditor {const char* section; const char* info;} HotkeysTextMusicEditor[] = 245 + { 246 + {"SHIFT+ENTER", "Play pattern from cursor position in the music editor."}, 247 + {"ENTER", "Play frame."}, 248 + {"SPACE", "Play track."}, 249 + {"CTRL+F", "Follow."}, 250 + {"Z,X,C,V,B,N,M", "Play notes corresponding to one octave (bottom row of QWERTY layout) in tracker mode."}, 251 + {"S,D,G,H,J", "Play notes corresponding to sharps and flats (home row of QWERTY layout) in tracker mode."}, 252 + {"A", "Insert note break (or 'stop')."}, 253 + {"DELETE", "Delete selection / selected row."}, 254 + {"BACKSPACE", "Delete the row above."}, 255 + {"INSERT", "Insert rows below."}, 256 + {"CTRL+F1", "Decrease notes by Semitone."}, 257 + {"CTRL+F2", "Increase notes by Semitone."}, 258 + {"CTRL+F3", "Decrease octaves."}, 259 + {"CTRL+F4", "Increase octaves."}, 260 + {"CTRL+RIGHT", "Jump forward one frame."}, 261 + {"CTRL+LEFT", "Jump backward one frame."}, 262 + {"TAB", "Go to next channel."}, 263 + {"SHIFT+TAB", "Go to previous channel."}, 264 + {"+", "Next pattern."}, 265 + {"-", "Previous pattern."}, 266 + {"CTRL+UP", "Next instrument."}, 267 + {"CTRL+DOWN", "Previous instrument."}, 268 + {"F5", "Switch piano/tracker mode.", 146 269 }, 147 270 }; 148 271 ··· 3250 3373 FOR(const struct StartupOption*, opt, StartupOptions) 3251 3374 ptr += sprintf(ptr, "--%-14s %s\n", opt->name, opt->help); 3252 3375 3376 + ptr += sprintf(ptr, "```\n\n## Hotkeys\n"); 3377 + 3378 + ptr += sprintf(ptr, "\n### General:\n```\n"); 3379 + FOR(const struct HotkeysRowGeneral*, row, HotkeysTextGeneral) 3380 + ptr += sprintf(ptr, "%-20s%s\n", row->section, row->info); 3381 + 3382 + ptr += sprintf(ptr, "```\n\n### Navigation:\n```\n"); 3383 + FOR(const struct HotkeysRowNavigation*, row, HotkeysTextNavigation) 3384 + ptr += sprintf(ptr, "%-20s%s\n", row->section, row->info); 3385 + 3386 + ptr += sprintf(ptr, "```\n\n### Code Editor:\n```\n"); 3387 + FOR(const struct HotkeysRowCodeEditor*, row, HotkeysTextCodeEditor) 3388 + ptr += sprintf(ptr, "%-20s%s\n", row->section, row->info); 3389 + 3390 + ptr += sprintf(ptr, "```\n\n### Sprite Editor:\n```\n"); 3391 + FOR(const struct HotkeysRowSpriteEditor*, row, HotkeysTextSpriteEditor) 3392 + ptr += sprintf(ptr, "%-20s%s\n", row->section, row->info); 3393 + 3394 + ptr += sprintf(ptr, "```\n\n### Map Editor:\n```\n"); 3395 + FOR(const struct HotkeysRowMapEditor*, row, HotkeysTextMapEditor) 3396 + ptr += sprintf(ptr, "%-20s%s\n", row->section, row->info); 3397 + 3398 + ptr += sprintf(ptr, "```\n\n### SFX Editor:\n```\n"); 3399 + FOR(const struct HotkeysRowSFXEditor*, row, HotkeysTextSFXEditor) 3400 + ptr += sprintf(ptr, "%-20s%s\n", row->section, row->info); 3401 + 3402 + ptr += sprintf(ptr, "```\n\n### Music Editor:\n```\n"); 3403 + FOR(const struct HotkeysRowMusicEditor*, row, HotkeysTextMusicEditor) 3404 + ptr += sprintf(ptr, "%-20s%s\n", row->section, row->info); 3405 + 3253 3406 ptr += sprintf(ptr, "```\n\n%s\n\n%s", TermsText, LicenseText); 3254 3407 3255 3408 char* helpReplaced = replaceHelpTokens(buf); ··· 3502 3655 free(rowReplaced); 3503 3656 #undef OFFSET 3504 3657 } 3658 + } 3659 + 3660 + static void onHelp_hotkeys(Console* console) 3661 + { 3662 + printLine(console); 3663 + 3664 + char buf[TICNAME_MAX]; 3665 + 3666 + printFront(console, "\nGeneral:\n"); 3667 + FOR(const struct HotkeysRowGeneral*, row, HotkeysTextGeneral) 3668 + { 3669 + #define OFFSET 14 3670 + char* rowReplaced = replaceHelpTokens(row->info); 3671 + sprintf(buf, "%-" DEF2STR(OFFSET) "s%s\n", row->section, rowReplaced); 3672 + consolePrintOffset(console, buf, tic_color_grey, OFFSET); 3673 + free(rowReplaced); 3674 + #undef OFFSET 3675 + } 3676 + 3677 + printFront(console, "\nNavigation:\n"); 3678 + FOR(const struct HotkeysRowNavigation*, row, HotkeysTextNavigation) 3679 + { 3680 + #define OFFSET 17 3681 + char* rowReplaced = replaceHelpTokens(row->info); 3682 + sprintf(buf, "%-" DEF2STR(OFFSET) "s%s\n", row->section, rowReplaced); 3683 + consolePrintOffset(console, buf, tic_color_grey, OFFSET); 3684 + free(rowReplaced); 3685 + #undef OFFSET 3686 + } 3687 + 3688 + printFront(console, "\nCode Editor:\n"); 3689 + FOR(const struct HotkeysRowCodeEditor*, row, HotkeysTextCodeEditor) 3690 + { 3691 + #define OFFSET 19 3692 + char* rowReplaced = replaceHelpTokens(row->info); 3693 + sprintf(buf, "%-" DEF2STR(OFFSET) "s%s\n", row->section, rowReplaced); 3694 + consolePrintOffset(console, buf, tic_color_grey, OFFSET); 3695 + free(rowReplaced); 3696 + #undef OFFSET 3697 + } 3698 + 3699 + printFront(console, "\nSprite Editor:\n"); 3700 + FOR(const struct HotkeysRowSpriteEditor*, row, HotkeysTextSpriteEditor) 3701 + { 3702 + #define OFFSET 9 3703 + char* rowReplaced = replaceHelpTokens(row->info); 3704 + sprintf(buf, "%-" DEF2STR(OFFSET) "s%s\n", row->section, rowReplaced); 3705 + consolePrintOffset(console, buf, tic_color_grey, OFFSET); 3706 + free(rowReplaced); 3707 + #undef OFFSET 3708 + } 3709 + 3710 + printFront(console, "\nMap Editor:\n"); 3711 + FOR(const struct HotkeysRowMapEditor*, row, HotkeysTextMapEditor) 3712 + { 3713 + #define OFFSET 11 3714 + char* rowReplaced = replaceHelpTokens(row->info); 3715 + sprintf(buf, "%-" DEF2STR(OFFSET) "s%s\n", row->section, rowReplaced); 3716 + consolePrintOffset(console, buf, tic_color_grey, OFFSET); 3717 + free(rowReplaced); 3718 + #undef OFFSET 3719 + } 3720 + 3721 + printFront(console, "\nSFX Editor:\n"); 3722 + FOR(const struct HotkeysRowSFXEditor*, row, HotkeysTextSFXEditor) 3723 + { 3724 + #define OFFSET 14 3725 + char* rowReplaced = replaceHelpTokens(row->info); 3726 + sprintf(buf, "%-" DEF2STR(OFFSET) "s%s\n", row->section, rowReplaced); 3727 + consolePrintOffset(console, buf, tic_color_grey, OFFSET); 3728 + free(rowReplaced); 3729 + #undef OFFSET 3730 + } 3731 + 3732 + printFront(console, "\nMusic Editor:\n"); 3733 + FOR(const struct HotkeysRowMusicEditor*, row, HotkeysTextMusicEditor) 3734 + { 3735 + #define OFFSET 14 3736 + char* rowReplaced = replaceHelpTokens(row->info); 3737 + sprintf(buf, "%-" DEF2STR(OFFSET) "s%s\n", row->section, rowReplaced); 3738 + consolePrintOffset(console, buf, tic_color_grey, OFFSET); 3739 + free(rowReplaced); 3740 + #undef OFFSET 3741 + } 3742 + 3743 + 3505 3744 } 3506 3745 3507 3746 static void onHelp_welcome(Console* console)