@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
ANY WAY OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE .
Portions of this software are copyright © 2023 The FreeType
Portions of this software are copyright <EFBFBD> 2023 The FreeType
Project ( www . freetype . org ) . Please see LICENSE_FT . txt for more information .
All rights reserved .
*/
@ -45,4 +45,35 @@ void Menu::InitializeLoadGameWindow(){
loadGameWindow - > ADD ( " Game Files Label " , MenuLabel ) ( geom2d : : rect < float > { { - 8 , - 12 } , { 112 , 12 } } , " Load Game " , 1.0f , ComponentAttr : : SHADOW | ComponentAttr : : OUTLINE | ComponentAttr : : BACKGROUND ) END ;
loadGameWindow - > ADD ( " Game Files List " , ScrollableWindowComponent ) ( geom2d : : rect < float > { { - 8 , 4 } , { 112 , 116 } } ) END ;
loadGameWindow - > ADD ( " Go Back Button " , MenuComponent ) ( geom2d : : rect < float > { { 24 , 124 } , { 48 , 12 } } , " Back " , [ ] ( MenuFuncData menu ) { Menu : : CloseMenu ( ) ; return true ; } ) END ;
loadGameWindow - > SetupKeyboardNavigation (
[ ] ( MenuType type ) { //On Open
if ( SaveFile : : GetSaveFileCount ( ) > 0 ) {
Menu : : menus [ type ] - > SetSelection ( Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) [ 0 ] ) ;
} else {
Menu : : menus [ type ] - > SetSelection ( " Go Back Button " ) ;
}
} ,
{ //Button Key
{ game - > KEY_START , { " Load File " , [ ] ( MenuType type ) {
Menu : : menus [ type ] - > GetSelection ( ) . lock ( ) - > Click ( ) ;
} } } ,
{ game - > KEY_SELECT , { " Return to Title Screen " , [ ] ( MenuType type ) {
Component < MenuComponent > ( type , " Back Button " ) - > Click ( ) ;
} } } ,
}
, { //Button Navigation Rules
{ " Game Files List " , {
. up = [ ] ( MenuType type ) {
auto & selection = Menu : : menus [ type ] - > GetSelection ( ) ;
auto & gameFilesList = Component < ScrollableWindowComponent > ( type , " Game Files List " ) - > GetComponents ( ) ;
if ( std : : find_if ( gameFilesList . begin ( ) , gameFilesList . end ( ) , [ & ] ( auto & comp ) { return comp . lock ( ) = = selection . lock ( ) ; } ) = = gameFilesList . begin ( ) ) {
}
} ,
. down = " Back Button " , } } ,
{ " Go Back Button " , {
. left = " Continue Button " ,
. right = " Continue Button " , } } ,
} ) ;
}