Added in shoulder button navigation schemes, related icons, and DAS press input handling for menu navigation. Added in button visibility settings for input helper. Added Confirm input display for load game window.

pull/35/head
sigonasr2 10 months ago
parent ce46a1d3d7
commit 6a5b74b3e6
  1. 26
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 3
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 4
      Adventures in Lestoria/InputHelper.cpp
  4. 10
      Adventures in Lestoria/Key.cpp
  5. 7
      Adventures in Lestoria/Key.h
  6. 10
      Adventures in Lestoria/LoadGameWindow.cpp
  7. 2
      Adventures in Lestoria/MainMenuWindow.cpp
  8. 3
      Adventures in Lestoria/Menu.cpp
  9. 7
      Adventures in Lestoria/ScrollableWindowComponent.h
  10. 2
      Adventures in Lestoria/Version.h
  11. 3
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  12. BIN
      Adventures in Lestoria/assets/themes/button_qe.png
  13. BIN
      Adventures in Lestoria/assets/themes/button_r1l1.png
  14. 5
      Adventures in Lestoria/olcPGEX_Gamepad.h
  15. 5
      Adventures in Lestoria/olcPixelGameEngine.h

@ -115,11 +115,14 @@ InputGroup AiL::KEY_UNEQUIP;
InputGroup AiL::KEY_SCROLLDOWN;
InputGroup AiL::KEY_SCROLLUP;
InputGroup AiL::KEY_FASTSCROLLDOWN;
InputGroup AiL::KEY_FASTSCROLLUP;
InputGroup AiL::KEY_SCROLLLEFT;
InputGroup AiL::KEY_SCROLLRIGHT;
InputGroup AiL::KEY_SCROLLHORZ;
InputGroup AiL::KEY_SCROLLVERT;
InputGroup AiL::KEY_SCROLL;
InputGroup AiL::KEY_SHOULDER;
InputGroup AiL::KEY_CHANGE_LOADOUT;
#ifndef __EMSCRIPTEN__
@ -2490,16 +2493,16 @@ void AiL::InitializeDefaultKeybinds(){
KEY_MENU.AddKeybind({KEY,ESCAPE});
KEY_MENU.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::START)});
KEY_SCROLLUP.AddKeybind({KEY,Q});
KEY_SCROLLUP.AddKeybind({KEY,PGUP});
KEY_SCROLLUP.AddKeybind({KEY,NP8});
KEY_SCROLLUP.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::L1)});
KEY_SCROLLUP.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::L2)});
KEY_SCROLLDOWN.AddKeybind({KEY,E});
KEY_SCROLLDOWN.AddKeybind({KEY,PGDN});
KEY_SCROLLDOWN.AddKeybind({KEY,NP2});
KEY_SCROLLDOWN.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::R1)});
KEY_SCROLLDOWN.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::R2)});
KEY_FASTSCROLLUP.AddKeybind({KEY,Q});
KEY_FASTSCROLLUP.AddKeybind({KEY,PGUP});
KEY_FASTSCROLLUP.AddKeybind({KEY,NP8});
KEY_FASTSCROLLUP.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::L1)});
KEY_FASTSCROLLUP.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::L2)});
KEY_FASTSCROLLDOWN.AddKeybind({KEY,E});
KEY_FASTSCROLLDOWN.AddKeybind({KEY,PGDN});
KEY_FASTSCROLLDOWN.AddKeybind({KEY,NP2});
KEY_FASTSCROLLDOWN.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::R1)});
KEY_FASTSCROLLDOWN.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::R2)});
KEY_CHANGE_LOADOUT.AddKeybind({KEY,X});
KEY_CHANGE_LOADOUT.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::FACE_U)});
@ -2523,6 +2526,9 @@ void AiL::InitializeDefaultKeybinds(){
KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast<int>(GPAxes::RX)});
KEY_SCROLL.AddKeybind({ANALOG,static_cast<int>(GPAxes::ALL)});
KEY_SHOULDER.AddKeybind({KEY,SHOULDER});
KEY_SHOULDER.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::SHOULDER)});
KEY_UNEQUIP.AddKeybind({KEY,R});
KEY_UNEQUIP.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::FACE_U)});

@ -86,6 +86,8 @@ public:
static InputGroup KEY_START;
static InputGroup KEY_SELECT;
static InputGroup KEY_FASTSCROLLDOWN;
static InputGroup KEY_FASTSCROLLUP;
static InputGroup KEY_SCROLLDOWN;
static InputGroup KEY_SCROLLUP;
static InputGroup KEY_SCROLLLEFT;
@ -93,6 +95,7 @@ public:
static InputGroup KEY_SCROLLHORZ;
static InputGroup KEY_SCROLLVERT;
static InputGroup KEY_SCROLL;
static InputGroup KEY_SHOULDER;
static InputGroup KEY_CHANGE_LOADOUT;
static float SIZE_CHANGE_SPEED;

@ -47,7 +47,9 @@ InputHelper::InputHelper(){}
void InputHelper::Initialize(MenuInputGroups&inputGroups){
for(auto&data:inputGroups){
this->inputGroups[data.first.GetGroup()]=data.second.first;
if(data.first.GetLabelVisible()){ //If the label is not visible, we don't care to include it in our list.
this->inputGroups[data.first.GetGroup()]=data.second.first;
}
}
}

@ -481,6 +481,7 @@ std::map<std::pair<InputType,int>,GenericKey::KeyInfo> GenericKey::keyLiteral={
{{KEY, OEM_8},{"\\"}},
{{KEY, CAPS_LOCK},{"CAP LK"}},
{{KEY, olc::ENUM_END},{""}},
{{KEY, SHOULDER},{"Q-E","themes/button_qe.png"}},
{{MOUSE, Mouse::LEFT},{"L.MOUSE"}},
{{MOUSE, Mouse::RIGHT},{"R.MOUSE"}},
{{MOUSE, Mouse::MIDDLE},{"M.MOUSE"}},
@ -500,6 +501,7 @@ std::map<std::pair<InputType,int>,GenericKey::KeyInfo> GenericKey::keyLiteral={
{{CONTROLLER, static_cast<int>(GPButtons::DPAD_R)},{"RIGHT"}},
{{CONTROLLER, static_cast<int>(GPButtons::DPAD_U)},{"UP"}},
{{CONTROLLER, static_cast<int>(GPButtons::DPAD_D)},{"DOWN"}},
{{CONTROLLER, static_cast<int>(GPButtons::SHOULDER)},{"L1-R1","themes/button_r1l1.png"}},
{{ANALOG, static_cast<int>(GPAxes::LY)},{"Up/Down","themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::RY)},{"Up/Down","themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::LX)},{"Right/Left","themes/button_analogstick_horz.png"}},
@ -589,8 +591,8 @@ const bool operator==(const Input&input1,const Input&input2){
return input1.type==input2.type&&input1.key==input2.key;
}
InputEngageGroup::InputEngageGroup(InputGroup&group,EngageType type)
:group(group),type(type){}
InputEngageGroup::InputEngageGroup(InputGroup&group,EngageType type,const bool labelVisible)
:group(group),type(type),labelVisible(labelVisible){}
const InputEngageGroup::EngageType InputEngageGroup::GetEngageType()const{
@ -653,4 +655,8 @@ void InputListener::Update(){
const int Input::GetKeyCode()const{
return key;
}
const bool InputEngageGroup::GetLabelVisible()const{
return labelVisible;
}

@ -121,8 +121,11 @@ public:
class InputEngageGroup{
public:
static const bool VISIBLE=true;
static const bool NOT_VISIBLE=false;
enum EngageType{
Pressed,
PressedDAS,
Held,
Released,
Analog,
@ -130,11 +133,13 @@ public:
private:
InputGroup&group;
EngageType type;
bool labelVisible;
public:
InputEngageGroup(InputGroup&group,EngageType type=Released);
InputEngageGroup(InputGroup&group,EngageType type=Released,const bool labelVisible=true);
const EngageType GetEngageType()const;
InputGroup&GetGroup()const;
const InputEngageGroup operator=(const InputEngageGroup&rhs);
const bool GetLabelVisible()const;
};
class GenericKey{

@ -98,7 +98,17 @@ void Menu::InitializeLoadGameWindow(){
{{game->KEY_BACK},{"Back to Title Screen",[](MenuType type){
Component<MenuComponent>(type,"Go Back Button")->Click();
}}},
{{game->KEY_CONFIRM},{"Load",[](MenuType type){}}},
{{game->KEY_SCROLLVERT,Analog},{"Scroll",[](MenuType type){}}},
{{game->KEY_SHOULDER,Pressed},{"Scroll",[](MenuType type){}}},
{{game->KEY_FASTSCROLLDOWN,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
auto gameFilesList=Component<ScrollableWindowComponent>(type,"Game Files List");
gameFilesList->IncreaseSelectionIndex(3.f);
}}},
{{game->KEY_FASTSCROLLUP,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
auto gameFilesList=Component<ScrollableWindowComponent>(type,"Game Files List");
gameFilesList->IncreaseSelectionIndex(-3.f);
}}},
}
,{ //Button Navigation Rules
{"Game Files List",{

@ -74,8 +74,8 @@ void Menu::InitializeMainMenuWindow(){
}
},
{ //Button Key
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
{game->KEY_BACK,{"Back",[](MenuType type){}}},
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
}
,{ //Button Navigation Rules
{"New Game Button",{

@ -312,6 +312,9 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
case Pressed:{
activated=input.GetGroup().Pressed();
}break;
case PressedDAS:{
activated=input.GetGroup().PressedDAS();
}break;
case Held:{
activated=input.GetGroup().Held();
}break;

@ -59,7 +59,6 @@ protected:
vf2d targetScrollOffset{};
float lastScrollUpdate=0.f;
float selectionIndex=0.f;
int selectionSkipIncrement=1; //How many items are on each row. This determines the increments that we skip by while scrolling.
protected:
inline bool OnScreen(std::weak_ptr<MenuComponent>component){
return geom2d::overlaps(geom2d::rect<float>{{},rect.size},geom2d::rect<float>{component.lock()->rect.pos+vf2d{2,2},component.lock()->rect.size-vf2d{2,2}});
@ -105,6 +104,12 @@ public:
return geom2d::overlaps(geom2d::rect<float>{Menu::menus[parentMenu]->pos+rect.pos,rect.size},game->GetMousePos())&& //Make sure the mouse is inside the parent window component first....
geom2d::overlaps(geom2d::rect<float>{Menu::menus[parentMenu]->pos+rect.pos+child->rect.pos,child->rect.size},game->GetMousePos());
}
inline void IncreaseSelectionIndex(const float val){
float prevIndex=selectionIndex;
selectionIndex=std::clamp(selectionIndex+val,0.f,float(components.size()-1));
if(size_t(prevIndex)!=size_t(selectionIndex)){Menu::menus[parentMenu]->SetSelection(components[size_t(selectionIndex)],false);}
}
protected:
virtual inline vf2d GetScrollAmount()const{
return scrollOffset;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 6933
#define VERSION_BUILD 6936
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -60,6 +60,9 @@ Images
GFX_Button_Face_L2 = themes/button_l2.png
GFX_Button_Face_R1 = themes/button_r1.png
GFX_Button_Face_R2 = themes/button_r2.png
GFX_Button_SHOULDER_QE = themes/button_qe.png
GFX_Button_SHOULDER_L1R1 = themes/button_r1l1.png
GFX_Button_AnalogStick = themes/button_analogstick.png
GFX_Overworld_Arrow = overworld_arrow.png
GFX_Exclamation = exclamation.png
GFX_Ursule2 = monsters/Ursule Mother of Bears2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

@ -139,7 +139,9 @@ namespace olc {
DPAD_L = 14,
DPAD_R = 15,
DPAD_U = 16,
DPAD_D = 17
DPAD_D = 17,
//UNREACHABLE ITEMS BELOW:
SHOULDER = 18,
};
enum class GPAxes {
@ -151,6 +153,7 @@ namespace olc {
TR = 3,
DX = 6,
DY = 7,
//UNREACHABLE ITEMS BELOW:
ALL = 8, //This does not actually do anything, but is useful for detecting an icon for any analog stick control!
};
#pragma endregion

@ -650,7 +650,10 @@ namespace olc
NP_MUL, NP_DIV, NP_ADD, NP_SUB, NP_DECIMAL, PERIOD,
EQUALS, COMMA, MINUS,
OEM_1, OEM_2, OEM_3, OEM_4, OEM_5, OEM_6, OEM_7, OEM_8,
CAPS_LOCK, ENUM_END
CAPS_LOCK, ENUM_END,
//UNREACHABLE ITEMS BELOW:
SHOULDER,
};
namespace Mouse

Loading…
Cancel
Save