Merge pull request #513 from technomancy/ctrl-page

Use ctrl-pageup/pagedown to cycle thru modes.
This commit is contained in:
Vadim Grigoruk 2018-01-22 11:04:32 +03:00 committed by GitHub
commit a3d6768d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -1027,6 +1027,19 @@ EditorMode getStudioMode()
return studio.mode; return studio.mode;
} }
void changeStudioMode(s32 dir)
{
const size_t modeCount = sizeof(Modes)/sizeof(Modes[0]);
for(size_t i = 0; i < modeCount; i++)
{
if(studio.mode == Modes[i])
{
setStudioMode(Modes[(i+dir+modeCount) % modeCount]);
return;
}
}
}
static void showGameMenu() static void showGameMenu()
{ {
studio.tic->api.pause(studio.tic); studio.tic->api.pause(studio.tic);
@ -1777,6 +1790,14 @@ static bool processShortcuts(SDL_KeyboardEvent* event)
default: break; default: break;
} }
} }
else if(mod & KMOD_LCTRL)
{
switch(event->keysym.sym)
{
case SDLK_PAGEUP: changeStudioMode(-1); return true;
case SDLK_PAGEDOWN: changeStudioMode(1); return true;
}
}
else else
{ {
switch(event->keysym.sym) switch(event->keysym.sym)