@@ -475,6 +475,7 @@ async fn main() {
475475 let mut username: String = "" . to_string ( ) ;
476476 let mut password: String = "" . to_string ( ) ;
477477 let mut logged_in: bool = false ;
478+ let mut current_difficulty: u8 = 0 ;
478479
479480 let mut cc_1001: Color = Color :: new ( 0.0 , 0.0 , 0.2 , 1.0 ) ;
480481 let mut cc_1002: Color = Color :: new ( 0.0 , 0.0 , 0.3 , 1.0 ) ;
@@ -495,7 +496,7 @@ async fn main() {
495496 // This just puts all the difficulty face textures into a vec
496497 // This is so the game can easily show difficulties
497498 println ! ( "Loading difficulty faces..." ) ;
498- for i in 0 ..10 {
499+ for i in 0 ..11 {
499500 difficulties. push (
500501 load_texture ( & format ! ( "./Resources/difficulties/{}.png" , i) )
501502 . await . expect ( "Failed to load difficulty face" )
@@ -1217,6 +1218,13 @@ async fn main() {
12171218 back_button. update ( delta_time) ;
12181219 upload_button. update ( delta_time) ;
12191220
1221+ if is_key_pressed ( KeyCode :: Left ) && current_difficulty > 0 {
1222+ current_difficulty -= 1 ;
1223+ } else if is_key_pressed ( KeyCode :: Right )
1224+ && current_difficulty < difficulties. len ( ) as u8 - 1 {
1225+ current_difficulty += 1 ;
1226+ }
1227+
12201228 if back_button. is_clicked ( ) {
12211229 game_state. 0 . set ( GameState :: Editor ) ;
12221230 }
@@ -1237,7 +1245,7 @@ async fn main() {
12371245 ( "data" , & level_data) ,
12381246 ( "creator" , & username) ,
12391247 ( "pass" , & password) ,
1240- ( "diff" , "2" )
1248+ ( "diff" , & current_difficulty . to_string ( ) )
12411249 ] )
12421250 . unwrap ( )
12431251 . into_body ( )
@@ -2037,6 +2045,24 @@ async fn main() {
20372045 & font
20382046 ) ;
20392047
2048+ draw_texture_ex (
2049+ & difficulties[ current_difficulty as usize ] ,
2050+ 0.0 ,
2051+ 40.0 ,
2052+ WHITE ,
2053+ DrawTextureParams {
2054+ dest_size : Some ( vec2 (
2055+ 400.0 ,
2056+ 400.0
2057+ ) ) ,
2058+ source : None ,
2059+ rotation : 0.0 ,
2060+ flip_x : false ,
2061+ flip_y : false ,
2062+ pivot : None
2063+ }
2064+ ) ;
2065+
20402066 back_button. draw ( false , None , 1.0 , false , & font) ;
20412067 upload_button. draw ( false , None , 1.0 , false , & font) ;
20422068 level_name_textbox. draw ( & font) ;
0 commit comments