Refactored analog control system to use digital DAS input system with directional input support.
This commit is contained in:
@@ -86,18 +86,6 @@ void Menu::InitializeConsumableInventoryWindow(){
|
||||
|
||||
auto okButton=inventoryWindow->ADD("OK Button",MenuComponent)(geom2d::rect<float>{{windowSize.x/2-24,173.f},{48,12}},"Ok",[](MenuFuncData data){Menu::CloseMenu();return true;})END;
|
||||
|
||||
#pragma region ScrollWindow macro lambda
|
||||
#define ScrollWindow(amount) \
|
||||
[](MenuType type){ \
|
||||
auto scrollWindow=Component<InventoryScrollableWindowComponent>(type,"inventory"); \
|
||||
scrollWindow->Scroll(amount); \
|
||||
int invWidth=int((scrollWindow->rect.size.x-12)/(float(scrollWindow->options.size.x)+scrollWindow->options.padding)); /*The inventory width determines how many items to skip at a time.*/ \
|
||||
scrollWindow->SetSelectionSkipIncrement(invWidth); \
|
||||
float scrollAmt=amount*game->GetElapsedTime()*"Interface.AnalogScrollSpeed"_F; \
|
||||
scrollWindow->IncreaseSelectionIndex(scrollAmt/24.f); \
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
inventoryWindow->SetupKeyboardNavigation(
|
||||
[](MenuType type,Data&returnData){ //On Open
|
||||
//Try to find the component that matches the loadout item we have on us.
|
||||
@@ -123,9 +111,7 @@ void Menu::InitializeConsumableInventoryWindow(){
|
||||
{game->KEY_BACK,{"Back",[](MenuType type){
|
||||
Menu::CloseMenu();
|
||||
}}},
|
||||
{{game->KEY_SCROLL,Analog},{"Scroll",ScrollWindow(game->KEY_SCROLL.Analog())}},
|
||||
{{game->KEY_SCROLLUP,Held},{"Scroll Up",ScrollWindow(-1.0f)}},
|
||||
{{game->KEY_SCROLLDOWN,Held},{"Scroll Down",ScrollWindow(1.0f)}},
|
||||
{{game->KEY_SCROLLVERT,Analog},{"Scroll",[](MenuType type){}}},
|
||||
}
|
||||
,{ //Button Navigation Rules
|
||||
{"OK Button",{
|
||||
|
||||
Reference in New Issue
Block a user