@ -48,6 +48,9 @@ INCLUDE_WINDOW_SIZE
InputHelper : : InputHelper ( ) { }
void InputHelper : : Initialize ( MenuInputGroups & inputGroups ) {
groupData . clear ( ) ; //HACK ALERT: WTF, somehow we must clear this map because there are references to things that are mixed up where they shouldn't be
// ONLY for the emscripten build. Clearing this map ensures that we start with fresh copies to things and it appears that emscripten
// likes this...?
groupData = inputGroups ;
}
@ -70,25 +73,24 @@ void InputHelper::Draw(){
# pragma region Populate all buttons to display
inputGroups . clear ( ) ;
groupedInputs . clear ( ) ;
for ( auto & data : groupData ) {
if ( data . first . GetLabelVisible ( ) ) { //If the label is not visible, we don't care to include it in our list.
if ( std : : holds_alternative < ButtonName > ( data . second . first ) ) {
const ButtonName & name = std : : get < ButtonName > ( data . second . first ) ;
groupedInputs [ name ] . push_back ( data . first . GetGroup ( ) ) ;
for ( auto & [ group , action ] : groupData ) {
if ( group . GetLabelVisible ( ) ) { //If the label is not visible, we don't care to include it in our list.
if ( std : : holds_alternative < ButtonName > ( action . first ) ) {
const ButtonName & name = std : : get < ButtonName > ( action . first ) ;
groupedInputs [ name ] . push_back ( group . GetGroup ( ) ) ;
if ( groupedInputs [ name ] . size ( ) > 1 ) continue ; //Skip adding to the list of input groups because this input already has been added.
} else
if ( std : : holds_alternative < std : : function < std : : string ( MenuFuncData ) > > ( data . second . first ) ) {
if ( std : : holds_alternative < std : : function < std : : string ( MenuFuncData ) > > ( action . first ) ) {
std : : weak_ptr < ScrollableWindowComponent > parentComponent ;
if ( ! Menu : : stack . back ( ) - > GetSelection ( ) . expired ( ) ) {
parentComponent = Menu : : stack . back ( ) - > GetSelection ( ) . lock ( ) - > parentComponent ;
}
std : : string name = std : : get < std : : function < std : : string ( MenuFuncData ) > > ( data . second . first ) ( MenuFuncData { * Menu : : stack . back ( ) , game , Menu : : stack . back ( ) - > GetSelection ( ) , parentComponent } ) ;
groupedInputs [ name ] . push_back ( data . first . GetGroup ( ) ) ;
std : : string name = std : : get < std : : function < std : : string ( MenuFuncData ) > > ( action . first ) ( MenuFuncData { * Menu : : stack . back ( ) , game , Menu : : stack . back ( ) - > GetSelection ( ) , parentComponent } ) ;
groupedInputs [ name ] . push_back ( group . GetGroup ( ) ) ;
if ( groupedInputs [ name ] . size ( ) > 1 ) continue ; //Skip adding to the list of input groups because this input already has been added.
}
this - > inputGroups [ data . first . GetGroup ( ) ] = data . second . first ;
this - > inputGroups [ group . GetGroup ( ) ] = action . first ;
}
}
for ( auto & [ group , display ] : inputGroups ) {