generated from tipragot/rust
Add a camera system #69
BIN
crates/border-wars/assets/caca.png
Normal file
BIN
crates/border-wars/assets/caca.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 KiB |
21
crates/border-wars/src/camera.rs
Normal file
21
crates/border-wars/src/camera.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//! TODO
|
||||||
|
|
||||||
|
use bevy::prelude::*;
|
||||||
|
|
||||||
|
/// TODO
|
||||||
|
pub struct CameraPlugin;
|
||||||
|
|
||||||
|
impl Plugin for CameraPlugin {
|
||||||
|
fn build(&self, app: &mut App) {
|
||||||
|
app.add_systems(Startup, init_camera);
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
|
|||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TODO
|
||||||
|
fn init_camera(mut commands: Commands) {
|
||||||
|
commands.spawn(Camera2dBundle::default());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn movement_system(){}
|
||||||
CoCo_Sol marked this conversation as resolved
Outdated
tipragot
commented
No abreviations No abreviations
|
|||||||
|
fn zoom_system(){}
|
||||||
|
|
|
@ -4,6 +4,7 @@ use bevy::prelude::*;
|
||||||
|
|
||||||
pub mod map;
|
pub mod map;
|
||||||
pub mod scenes;
|
pub mod scenes;
|
||||||
|
pub mod camera;
|
||||||
|
|
||||||
/// The current scene of the game.
|
/// The current scene of the game.
|
||||||
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
|
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
//! The main entry point of the game.
|
//! The main entry point of the game.
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use border_wars::scenes::ScenesPlugin;
|
use border_wars::{camera::CameraPlugin, scenes::ScenesPlugin};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.add_plugins(ScenesPlugin)
|
.add_plugins(ScenesPlugin)
|
||||||
|
.add_plugins(CameraPlugin)
|
||||||
|
.add_systems(OnEnter(border_wars::CurrentScene::Game), init_shap)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn init_shap(mut commands: Commands, assets_server: Res<AssetServer>) {
|
||||||
|
commands.spawn(SpriteBundle{
|
||||||
|
texture: assets_server.load("caca.png").into(),
|
||||||
|
..Default::default()
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue
This should be a resource and the others too