Initital commit
This commit is contained in:
commit
c45cdd8573
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target
|
1792
Cargo.lock
generated
Normal file
1792
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
9
Cargo.toml
Normal file
9
Cargo.toml
Normal 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
36
src/main.rs
Normal 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())
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user