From 4a6009646c4e50990491eefc8778e404383c0479 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 19 Jan 2019 19:24:01 +0100 Subject: [PATCH] Implement keyboard navigation --- Stub/init.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Stub/init.cpp b/Stub/init.cpp index ceb2bb828..7f74e9ad2 100644 --- a/Stub/init.cpp +++ b/Stub/init.cpp @@ -20,6 +20,7 @@ bool StartNewGame; bool CreateSinglePlayerChar; int HeroChosen = 0; int menu = 0; +int SelectedItem = 0; /** * Case insensitive search for a file name in a directory. @@ -148,7 +149,9 @@ void SetMenu(int MenuId) pPcxTitleImage = NULL; mem_free_dbg(tmp); TitleImageLoaded = false; + menu = MenuId; + SelectedItem = 0; } void ExitDiablo() @@ -176,8 +179,6 @@ void SDL_Diablo_UI() // I anticipate to move this later. int CharsLoaded = 0; int HeroPortrait = 3; - int Selection[4]; - printf("Main Menu Init\n"); // SDL_ShowCursor(SDL_DISABLE);//Doesn't really work... Use HideCursor() instead. if (!window) { @@ -262,6 +263,14 @@ void SDL_Diablo_UI() // I anticipate to move this later. } break; + case SDLK_UP: + SelectedItem--; + break; + + case SDLK_DOWN: + SelectedItem++; + break; + case SDLK_RETURN: default: