lebron asset loading
This commit is contained in:
29
src/main.rs
29
src/main.rs
@@ -1,14 +1,29 @@
|
||||
use bevy::prelude::*;
|
||||
use asset_loading::ImageAssets;
|
||||
use bevy::{prelude::*, state::app::StatesPlugin};
|
||||
|
||||
mod asset_loading;
|
||||
|
||||
fn main() -> AppExit {
|
||||
App::new()
|
||||
.add_plugins((DefaultPlugins))
|
||||
.add_plugins((DefaultPlugins, asset_loading::plugin))
|
||||
.init_state::<GameState>()
|
||||
// We need to register components to make them visible to Blenvy
|
||||
.register_type::<Player>()
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(OnExit(GameState::Loading), debug_our_king)
|
||||
.run()
|
||||
}
|
||||
|
||||
#[derive(States, Default, Clone, Eq, PartialEq, Debug, Hash)]
|
||||
enum GameState {
|
||||
/// During the loading State the loading_plugin will load our assets
|
||||
#[default]
|
||||
Loading,
|
||||
/// During this State the actual game logic is executed
|
||||
Playing,
|
||||
/// Here the menu is drawn and waiting for player interaction
|
||||
Menu,
|
||||
}
|
||||
|
||||
#[derive(Component, Reflect)]
|
||||
struct Player {
|
||||
strength: f32,
|
||||
@@ -20,4 +35,10 @@ struct Player {
|
||||
luck: f32,
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands) {}
|
||||
fn setup(mut commands: Commands) {
|
||||
commands.spawn(Camera2d);
|
||||
}
|
||||
|
||||
fn debug_our_king(mut commands: Commands, images: Res<ImageAssets>) {
|
||||
commands.spawn(Sprite::from_image(images.king.clone()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user