Skip to content

Commit 1c9f4ec

Browse files
Added an empty editor keybinds menu
I'm sick so I probably won't actually add the keybinds yet but the button is there now.
1 parent ced62b2 commit 1c9f4ec

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

src/funcs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ impl GameState {
506506
GameState::LevelPage => return "LevelPage".to_string(),
507507
GameState::AccountPage => return "AccountPage".to_string(),
508508
GameState::LevelUpload => return "LevelUpload".to_string(),
509+
GameState::EditorKeybinds => return "EditorKeybinds".to_string(),
509510
}
510511
}
511512
}

src/main.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ async fn main() {
105105
false
106106
);
107107

108+
let mut editor_keybinds_button = Button::new(
109+
|| screen_width() - 210.0,
110+
|| 10.0,
111+
|| 200.0,
112+
|| 100.0,
113+
"Editor Keybinds",
114+
15,
115+
false
116+
);
117+
108118
let mut build_tab_button = Button::new(
109119
|| 15.0,
110120
|| screen_height() - 190.0,
@@ -994,6 +1004,7 @@ async fn main() {
9941004

9951005
GameState::CreatorMenu => {
9961006
back_button.update(delta_time);
1007+
editor_keybinds_button.update(delta_time);
9971008

9981009
featured_button.update(delta_time);
9991010
create_button.update(delta_time);
@@ -1003,6 +1014,10 @@ async fn main() {
10031014
game_state.0.set(GameState::Menu)
10041015
}
10051016

1017+
if editor_keybinds_button.is_clicked() {
1018+
game_state.0.set(GameState::EditorKeybinds);
1019+
}
1020+
10061021
if create_button.is_clicked() {
10071022
let level_data: String = std::fs::read_to_string("./save-data/level.txt").unwrap();
10081023

@@ -1511,6 +1526,14 @@ async fn main() {
15111526
level_name_textbox.input();
15121527
level_desc_textbox.input();
15131528
}
1529+
1530+
GameState::EditorKeybinds => {
1531+
back_button.update(delta_time);
1532+
1533+
if back_button.is_clicked() {
1534+
game_state.0.set(GameState::CreatorMenu);
1535+
}
1536+
}
15141537
}
15151538

15161539
// Drawing
@@ -1779,6 +1802,7 @@ async fn main() {
17791802

17801803
GameState::CreatorMenu => {
17811804
back_button.draw(false, None, 1.0, false, &font);
1805+
editor_keybinds_button.draw(false, None, 1.0, false, &font);
17821806
featured_button.draw(false, None, 1.0, false, &font);
17831807
create_button.draw(false, None, 1.0, false, &font);
17841808
search_button.draw(false, None, 1.0, false, &font);
@@ -2225,6 +2249,10 @@ async fn main() {
22252249
level_name_textbox.draw(&font);
22262250
level_desc_textbox.draw(&font);
22272251
}
2252+
2253+
GameState::EditorKeybinds => {
2254+
back_button.draw(false, None, 1.0, false, &font);
2255+
}
22282256
}
22292257

22302258
// Runs the draw function of every mod

src/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ pub enum GameState {
1717
SearchPage,
1818
LevelPage,
1919
AccountPage,
20-
LevelUpload
20+
LevelUpload,
21+
EditorKeybinds
2122
}
2223

2324
pub struct Button {

0 commit comments

Comments
 (0)