Skip to content

Commit 332fc8a

Browse files
Added an empty chat menu
A while back when fyre was still in development I made a simple backend for geometry rays that is basically a chat system. It was left unused for a while but now I am finally adding it.
1 parent 003c188 commit 332fc8a

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

src/funcs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ impl GameState {
507507
GameState::AccountPage => return "AccountPage".to_string(),
508508
GameState::LevelUpload => return "LevelUpload".to_string(),
509509
GameState::EditorKeybinds => return "EditorKeybinds".to_string(),
510+
GameState::ChatMenu => return "ChatMenu".to_string(),
510511
}
511512
}
512513
}

src/main.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ async fn main() {
295295
);
296296

297297
let mut account_button = Button::new(
298-
|| screen_width() as f32 - 210.0,
298+
|| screen_width() - 210.0,
299299
|| 10.0,
300300
|| 200.0,
301301
|| 100.0,
@@ -304,6 +304,16 @@ async fn main() {
304304
false
305305
);
306306

307+
let mut chat_button = Button::new(
308+
|| screen_width() - 210.0,
309+
|| screen_height() - 110.0,
310+
|| 200.0,
311+
|| 100.0,
312+
"Chat",
313+
20,
314+
false
315+
);
316+
307317
let mut username_textbox = TextBox::new(
308318
|| screen_width() / 2.0 - (20.0 * 18.0) / 2.0,
309319
|| screen_height() / 2.0 - 27.5 - 32.5,
@@ -767,6 +777,7 @@ async fn main() {
767777
play_button.update(delta_time);
768778
creator_button.update(delta_time);
769779
account_button.update(delta_time);
780+
chat_button.update(delta_time);
770781

771782
if play_button.is_clicked() {
772783
game_state.0.set(GameState::LevelSelect)
@@ -780,6 +791,10 @@ async fn main() {
780791
game_state.0.set(GameState::AccountPage);
781792
}
782793

794+
if chat_button.is_clicked() {
795+
game_state.0.set(GameState::ChatMenu);
796+
}
797+
783798
if is_key_pressed(KeyCode::Slash) {
784799
debug_mode = true;
785800
}
@@ -1534,6 +1549,14 @@ async fn main() {
15341549
game_state.0.set(GameState::CreatorMenu);
15351550
}
15361551
}
1552+
1553+
GameState::ChatMenu => {
1554+
back_button.update(delta_time);
1555+
1556+
if back_button.is_clicked() {
1557+
game_state.0.set(GameState::Menu);
1558+
}
1559+
}
15371560
}
15381561

15391562
// Drawing
@@ -1618,6 +1641,7 @@ async fn main() {
16181641
play_button.draw(false, None, 1.0, false, &font);
16191642
creator_button.draw(false, None, 1.0, false, &font);
16201643
account_button.draw(false, None, 1.0, false, &font);
1644+
chat_button.draw(false, None, 1.0, false, &font);
16211645
}
16221646

16231647
GameState::LevelSelect => {
@@ -2299,6 +2323,10 @@ async fn main() {
22992323
&font
23002324
);
23012325
}
2326+
2327+
GameState::ChatMenu => {
2328+
back_button.draw(false, None, 1.0, false, &font);
2329+
}
23022330
}
23032331

23042332
// Runs the draw function of every mod

src/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ pub enum GameState {
1818
LevelPage,
1919
AccountPage,
2020
LevelUpload,
21-
EditorKeybinds
21+
EditorKeybinds,
22+
ChatMenu
2223
}
2324

2425
pub struct Button {

0 commit comments

Comments
 (0)