Initital commit

This commit is contained in:
Fabian Becker 2022-01-25 08:50:32 +01:00
commit c45cdd8573
4 changed files with 1838 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1792
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

9
Cargo.toml Normal file
View File

@ -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
src/main.rs Normal file
View File

@ -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())
}