diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-24 14:48:12 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-24 14:48:12 +0200 |
| commit | 5d6b5049c2a34a3f8abe725d4a871ba84a0dd714 (patch) | |
| tree | 57cb03bf59b3358a96742f455d38c21f4f645396 /src/bin/client/games/traits.rs | |
| parent | stable and working, both platforms (diff) | |
| download | zagan-bet-5d6b5049c2a34a3f8abe725d4a871ba84a0dd714.tar.gz zagan-bet-5d6b5049c2a34a3f8abe725d4a871ba84a0dd714.zip | |
TLS transport and games framework on client and server
Diffstat (limited to 'src/bin/client/games/traits.rs')
| -rw-r--r-- | src/bin/client/games/traits.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bin/client/games/traits.rs b/src/bin/client/games/traits.rs new file mode 100644 index 0000000..19f2638 --- /dev/null +++ b/src/bin/client/games/traits.rs | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | use std::collections::HashMap; | ||
| 2 | |||
| 3 | #[derive(Debug, Clone)] | ||
| 4 | pub enum GameError { | ||
| 5 | InvalidAction, | ||
| 6 | NetworkError, | ||
| 7 | } | ||
| 8 | |||
| 9 | #[derive(Debug, Clone, PartialEq)] | ||
| 10 | pub enum GamePhase { | ||
| 11 | WaitingToStart, | ||
| 12 | } | ||
| 13 | |||
| 14 | #[derive(Debug, Clone)] | ||
| 15 | pub struct GameState { | ||
| 16 | pub game_type: String, | ||
| 17 | pub bet_amount: u64, | ||
| 18 | pub phase: GamePhase, | ||
| 19 | pub data: HashMap<String, String>, | ||
| 20 | } | ||
| 21 | |||
| 22 | pub trait Game: Send + Sync { | ||
| 23 | fn get_name(&self) -> &'static str; | ||
| 24 | |||
| 25 | fn render(&self, state: &GameState) -> String; | ||
| 26 | |||
| 27 | fn render_lines(&self, state: &GameState) -> usize; | ||
| 28 | |||
| 29 | fn get_help(&self) -> String; | ||
| 30 | } | ||
