Initital commit
This commit is contained in:
commit
c45cdd8573
4 files changed
+1838
No files matched your search
@@ -0,0 +1 @@
|
||||
/target
|
||||
Generated
+1792
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "flappy"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bracket-lib = "~0.8.1"
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
use bracket_lib::prelude::*;
|
||||
|
||||
struct State {
|
||||
mode: GameMode,
|
||||
}
|
||||
|
||||
|
||||
impl State {
|
||||
fn new() -> State {
|
||||
State {
|
||||
mode: GameMode::Menu,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum GameMode {
|
||||
Menu,
|
||||
Playing,
|
||||
End,
|
||||
}
|
||||
|
||||
impl GameState for State {
|
||||
fn tick(&mut self, ctx: &mut BTerm) {
|
||||
match self.mode {
|
||||
GameMode::Menu => self.main_menu(ctx),
|
||||
GameMode::End => self.dead(ctx),
|
||||
GameMode::Playing => self.play(ctx),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> BError {
|
||||
let context = BTermBuilder::simple80x50().with_title("Flappy Dragon").build()?;
|
||||
main_loop(context, State::new())
|
||||
}
|
||||
Reference in new issue
Block a user