Forráskód Böngészése

:sparkles: still getting stuff working. docs should work now

Felix Bytow 2 éve
szülő
commit
dbc38832e5
6 módosított fájl, 66 hozzáadás és 4 törlés
  1. 4 0
      CHANGELOG.md
  2. 1 1
      Cargo.toml
  3. 2 2
      README.md
  4. 10 0
      src/common_components.rs
  5. 17 1
      src/main.rs
  6. 32 0
      src/main_menu.rs

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 # Changelog
 
+## Release 0.1.2
+
+- Docs should work now.
+
 ## Release 0.1.1
 
 - Still setting stuff up.

+ 1 - 1
Cargo.toml

@@ -4,7 +4,7 @@ authors = ["Felix Bytow <drako@drako.guru>"]
 description = "Snake game using the Bevy Engine"
 license = "MIT"
 repository = "https://git.drako.guru/drako/bevy-snake"
-version = "0.1.1"
+version = "0.1.2"
 edition = "2021"
 publish = ["crates-drako-guru"]
 

+ 2 - 2
README.md

@@ -1,7 +1,7 @@
 # bevy-snake
 
 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
-[![Version: 0.1.1](https://img.shields.io/badge/crates.drako.guru-v0.1.1-blue)](https://crates.drako.guru/#/crate?name=bevy-snake&version=0.1.1)
-[![Documentation](https://img.shields.io/badge/documentation-v0.1.1-lightgrey)](https://crates.drako.guru/docs/bevy-snake/0.1.1/doc/bevy-snake/index.html)
+[![Version: 0.1.2](https://img.shields.io/badge/crates.drako.guru-v0.1.2-blue)](https://crates.drako.guru/#/crate?name=bevy-snake&version=0.1.2)
+[![Documentation](https://img.shields.io/badge/documentation-v0.1.2-lightgrey)](https://crates.drako.guru/docs/bevy-snake/0.1.2/doc/bevy-snake/index.html)
 
 A snake game in Rust using the [Bevy Engine](https://bevyengine.org/).

+ 10 - 0
src/common_components.rs

@@ -0,0 +1,10 @@
+use bevy::prelude::*;
+
+#[derive(Component)]
+pub struct Activated;
+
+#[derive(Component)]
+pub struct Label(pub String);
+
+#[derive(Component)]
+pub struct Index(pub u32);

+ 17 - 1
src/main.rs

@@ -1,3 +1,19 @@
+use bevy::prelude::*;
+
+pub use common_components::*;
+
+mod main_menu;
+mod common_components;
+
+#[derive(Clone, Eq, PartialEq, Debug, Hash)]
+enum GameState {
+    MainMenu,
+    Playing,
+    GameOver,
+}
+
 fn main() {
-    println!("The answer is {}.", 6 * 7);
+    App::new()
+        .add_plugins(DefaultPlugins)
+        .run();
 }

+ 32 - 0
src/main_menu.rs

@@ -0,0 +1,32 @@
+use bevy::prelude::*;
+
+pub struct MainMenuPlugin;
+
+#[derive(Bundle, Default)]
+struct MenuItemBundle {
+    #[bundle]
+    text_bundle: TextBundle,
+}
+
+impl Plugin for MainMenuPlugin {
+    fn build(&self, app: &mut App) {
+        app.add_startup_system(setup_menu_items);
+    }
+
+    fn name(&self) -> &str {
+        "Main Menu"
+    }
+}
+
+fn setup_menu_items(_: Commands) {
+    /*
+    commands.spawn()
+        .insert(Position(Vec2::new(10.0, 10.0)))
+        .insert(Label("New game".to_owned()))
+        .insert(Activated);
+
+    commands.spawn()
+        .insert(Position(Vec2::new(10.0, 30.0)))
+        .insert(Label("Quit".to_owned()));
+     */
+}