@@ -309,6 +309,36 @@ async fn main() {
309309 false
310310 ) ;
311311
312+ let mut username_textbox = TextBox {
313+ rect : Rect {
314+ x : screen_width ( ) / 2.0 - ( 20.0 * 18.0 ) / 2.0 ,
315+ y : screen_height ( ) / 2.0 - 27.5 - 32.5 ,
316+ w : 20.0 * 18.0 ,
317+ h : 55.0
318+ } ,
319+ text : "Username" . to_string ( ) ,
320+ input : "" . to_string ( ) ,
321+ text_size : 18 ,
322+ max_length : 20 ,
323+ spaces_allowed : false ,
324+ active : false
325+ } ;
326+
327+ let mut password_textbox = TextBox {
328+ rect : Rect {
329+ x : screen_width ( ) / 2.0 - ( 20.0 * 18.0 ) / 2.0 ,
330+ y : screen_height ( ) / 2.0 - 27.5 + 32.5 ,
331+ w : 20.0 * 18.0 ,
332+ h : 55.0
333+ } ,
334+ text : "Password" . to_string ( ) ,
335+ input : "" . to_string ( ) ,
336+ text_size : 18 ,
337+ max_length : 20 ,
338+ spaces_allowed : false ,
339+ active : false
340+ } ;
341+
312342 // Url's for server requests
313343 let main_url = "http://georays.puppet57.xyz/php-code/" . to_string ( ) ;
314344 let latest_version_url: String = format ! ( "{}get-latest-version.php" , main_url) . to_string ( ) ;
@@ -1195,6 +1225,25 @@ async fn main() {
11951225 if back_button. is_clicked ( ) {
11961226 game_state. 0 . set ( GameState :: Menu ) ;
11971227 }
1228+
1229+ if username_textbox. is_clicked ( ) {
1230+ username_textbox. active = true
1231+ }
1232+
1233+ if username_textbox. is_not_clicked ( ) {
1234+ username_textbox. active = false
1235+ }
1236+
1237+ if password_textbox. is_clicked ( ) {
1238+ password_textbox. active = true
1239+ }
1240+
1241+ if password_textbox. is_not_clicked ( ) {
1242+ password_textbox. active = false
1243+ }
1244+
1245+ username_textbox. input ( ) ;
1246+ password_textbox. input ( ) ;
11981247 }
11991248 }
12001249
@@ -1942,6 +1991,8 @@ async fn main() {
19421991 ) ;
19431992
19441993 back_button. draw ( false , None , 1.0 , false , & font) ;
1994+ username_textbox. draw ( & font) ;
1995+ password_textbox. draw ( & font) ;
19451996 }
19461997 }
19471998
0 commit comments