Skip to content

Commit 944d9ef

Browse files
Added an empty account page
be careful with the page
1 parent b0fa2a1 commit 944d9ef

3 files changed

Lines changed: 49 additions & 1 deletion

File tree

src/funcs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ impl GameState {
456456
GameState::LevelSettings => return "LevelSettings".to_string(),
457457
GameState::SearchPage => return "SearchPage".to_string(),
458458
GameState::LevelPage => return "LevelPage".to_string(),
459+
GameState::AccountPage => return "AccountPage".to_string(),
459460
}
460461
}
461462
}

src/main.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ async fn main() {
292292
false
293293
);
294294

295+
let mut account_button = Button::new(
296+
|| screen_width() as f32 - 210.0,
297+
|| 10.0,
298+
|| 200.0,
299+
|| 100.0,
300+
"Account",
301+
20,
302+
false
303+
);
304+
295305
// Url's for server requests
296306
let main_url = "http://georays.puppet57.xyz/php-code/".to_string();
297307
let latest_version_url: String = format!("{}get-latest-version.php", main_url).to_string();
@@ -572,6 +582,7 @@ async fn main() {
572582
GameState::Menu => {
573583
play_button.update(delta_time);
574584
creator_button.update(delta_time);
585+
account_button.update(delta_time);
575586

576587
if play_button.is_clicked() {
577588
game_state.0.set(GameState::LevelSelect)
@@ -581,6 +592,10 @@ async fn main() {
581592
game_state.0.set(GameState::CreatorMenu)
582593
}
583594

595+
if account_button.is_clicked() {
596+
game_state.0.set(GameState::AccountPage);
597+
}
598+
584599
if is_key_pressed(KeyCode::Slash) {
585600
debug_mode = true;
586601
}
@@ -1177,6 +1192,14 @@ async fn main() {
11771192
}
11781193
}
11791194
}
1195+
1196+
GameState::AccountPage => {
1197+
back_button.update(delta_time);
1198+
1199+
if back_button.is_clicked() {
1200+
game_state.0.set(GameState::Menu);
1201+
}
1202+
}
11801203
}
11811204

11821205
// Drawing
@@ -1260,6 +1283,7 @@ async fn main() {
12601283

12611284
play_button.draw(false, None, 1.0, false, &font);
12621285
creator_button.draw(false, None, 1.0, false, &font);
1286+
account_button.draw(false, None, 1.0, false, &font);
12631287
}
12641288

12651289
GameState::LevelSelect => {
@@ -1901,6 +1925,28 @@ async fn main() {
19011925
back_button.draw(false, None, 1.0, false, &font);
19021926
level_play_button.draw(false, None, 1.0, false, &font);
19031927
}
1928+
1929+
GameState::AccountPage => {
1930+
draw_texture_ex(
1931+
&default_bg_no_gradient,
1932+
-50.0,
1933+
-75.0,
1934+
Color::from_rgba(20, 20, 20, 255),
1935+
DrawTextureParams {
1936+
dest_size: Some(Vec2 {
1937+
x: default_bg_no_gradient.width() * screen_width() as f32 * 0.0008,
1938+
y: default_bg_no_gradient.height() * screen_width() as f32 * 0.0008
1939+
}),
1940+
source: None,
1941+
rotation: 0.0,
1942+
flip_x: false,
1943+
flip_y: false,
1944+
pivot: None
1945+
}
1946+
);
1947+
1948+
back_button.draw(false, None, 1.0, false, &font);
1949+
}
19041950
}
19051951

19061952
// Runs the draw function of every mod

src/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ pub enum GameState {
1515
LevelComplete,
1616
LevelSettings,
1717
SearchPage,
18-
LevelPage
18+
LevelPage,
19+
AccountPage
1920
}
2021

2122
pub struct Button {

0 commit comments

Comments
 (0)