@ -52,72 +52,72 @@ void Menu::InitializeLoadGameWindow(){
# define ScrollWindow(amount) \
# define ScrollWindow(amount) \
[ ] ( MenuType type ) { \
[ ] ( MenuType type ) { \
auto scrollWindow = Component < ScrollableWindowComponent > ( type , " Game Files List " ) ; \
auto scrollWindow = Component < ScrollableWindowComponent > ( type , " Game Files List " ) ; \
float scrollAmt = amount * game - > GetElapsedTime ( ) * " Interface.AnalogScrollSpeed " _F ; \
scrollWindow - > Scroll ( amount ) ; \
\
float scrollAmt = amount * game - > GetElapsedTime ( ) * " Interface.AnalogScrollSpeed " _F ; \
scrollWindow - > SetScrollAmount ( scrollWindow - > GetTargetScrollAmount ( ) - vf2d { 0 , amount * game - > GetElapsedTime ( ) * " Interface.AnalogScrollSpeed " _F } ) ; \
\
/*Height of these buttons is 48.*/ \
/*Height of these buttons is 48.*/ \
scrollWindow - > IncreaseSelectionIndex ( scrollAmt / 48.f ) ; \
scrollWindow - > IncreaseSelectionIndex ( scrollAmt / 48.f ) ; \
}
}
# pragma endregion
# pragma endregion
loadGameWindow - > SetupKeyboardNavigation (
# pragma region Keyboard Navigation Rules
[ ] ( MenuType type , Data & returnData ) { //On Open
loadGameWindow - > SetupKeyboardNavigation (
if ( SaveFile : : GetSaveFileCount ( ) > 0 ) {
[ ] ( MenuType type , Data & returnData ) { //On Open
returnData = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) [ 0 ] ;
if ( SaveFile : : GetSaveFileCount ( ) > 0 ) {
} else {
returnData = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) [ 0 ] ;
returnData = " Go Back Button " ;
} else {
returnData = " Go Back Button " ;
}
} ,
{ //Button Key
{ { game - > KEY_BACK } , { " Back to Title Screen " , [ ] ( MenuType type ) {
Component < MenuComponent > ( type , " Go Back Button " ) - > Click ( ) ;
} } } ,
{ { 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 ) } } ,
}
}
} ,
, { //Button Navigation Rules
{ //Button Key
{ " Game Files List " , {
{ { game - > KEY_BACK } , { " Back to Title Screen " , [ ] ( MenuType type ) {
. up = [ ] ( MenuType type , Data & returnData ) {
Component < MenuComponent > ( type , " Go Back Button " ) - > Click ( ) ;
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
} } } ,
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
{ { game - > KEY_SCROLL , Analog } , { " Scroll " , ScrollWindow ( game - > KEY_SCROLL . Analog ( ) ) } } ,
auto component = std : : find_if ( gameFilesList . begin ( ) , gameFilesList . end ( ) , [ & ] ( auto & comp ) { return comp . lock ( ) = = selection . lock ( ) ; } ) ;
{ { game - > KEY_SCROLLUP , Held } , { " Scroll Up " , ScrollWindow ( - 1.0f ) } } ,
if ( component = = gameFilesList . begin ( ) ) {
{ { game - > KEY_SCROLLDOWN , Held } , { " Scroll Down " , ScrollWindow ( 1.0f ) } } ,
returnData = " Go Back Button " ;
}
} else {
, { //Button Navigation Rules
returnData = * ( - - component ) ;
{ " Game Files List " , {
}
. up = [ ] ( MenuType type , Data & returnData ) {
} ,
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
. down = [ ] ( MenuType type , Data & returnData ) {
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
auto component = std : : find_if ( gameFilesList . begin ( ) , gameFilesList . end ( ) , [ & ] ( auto & comp ) { return comp . lock ( ) = = selection . lock ( ) ; } ) ;
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
if ( component = = gameFilesList . begin ( ) ) {
auto component = std : : find_if ( gameFilesList . begin ( ) , gameFilesList . end ( ) , [ & ] ( auto & comp ) { return comp . lock ( ) = = selection . lock ( ) ; } ) ;
returnData = " Go Back Button " ;
if ( component = = gameFilesList . end ( ) - 1 ) {
} else {
returnData = " Go Back Button " ;
returnData = * ( - - component ) ;
} else {
}
returnData = * ( + + component ) ;
} ,
}
. down = [ ] ( MenuType type , Data & returnData ) {
} , } } ,
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
{ " Go Back Button " , {
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
. up = [ ] ( MenuType type , Data & returnData ) {
auto component = std : : find_if ( gameFilesList . begin ( ) , gameFilesList . end ( ) , [ & ] ( auto & comp ) { return comp . lock ( ) = = selection . lock ( ) ; } ) ;
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
if ( component = = gameFilesList . end ( ) - 1 ) {
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
returnData = " Go Back Button " ;
if ( gameFilesList . size ( ) = = 0 ) {
} else {
returnData = " Go Back Button " ;
returnData = * ( + + component ) ;
return ;
}
}
} , } } ,
returnData = * ( gameFilesList . end ( ) - 1 ) ;
{ " Go Back Button " , {
} ,
. up = [ ] ( MenuType type , Data & returnData ) {
. down = [ ] ( MenuType type , Data & returnData ) {
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
if ( gameFilesList . size ( ) = = 0 ) {
if ( gameFilesList . size ( ) = = 0 ) {
returnData = " Go Back Button " ;
returnData = " Go Back Button " ;
return ;
return ;
}
}
returnData = * ( gameFilesList . end ( ) - 1 ) ;
returnData = * ( gameFilesList . begin ( ) ) ;
} ,
} ,
. down = [ ] ( MenuType type , Data & returnData ) {
} } ,
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
} ) ;
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
# pragma endregion
if ( gameFilesList . size ( ) = = 0 ) {
returnData = " Go Back Button " ;
return ;
}
returnData = * ( gameFilesList . begin ( ) ) ;
} ,
} } ,
} ) ;
}
}