diff options
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 | } | ||
