mirror of
https://codeberg.org/schrottkatze/mgd2-tram-championships.git
synced 2025-06-12 02:47:38 +00:00
do a basic scene and way too much organization and fail to implement panning
This commit is contained in:
parent
08069c9224
commit
6d269d0c14
6 changed files with 156 additions and 29 deletions
45
src/main.rs
45
src/main.rs
|
@ -1,36 +1,23 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
mod camera;
|
||||
mod cleanup;
|
||||
mod game;
|
||||
|
||||
#[derive(States, Default, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
#[allow(unused)]
|
||||
enum AppState {
|
||||
Menus,
|
||||
#[default]
|
||||
Ingame,
|
||||
PostGame,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_systems(Startup, yeet)
|
||||
.init_state::<AppState>()
|
||||
.add_plugins(game::plugin)
|
||||
.add_systems(Startup, camera::setup)
|
||||
.run();
|
||||
}
|
||||
|
||||
fn yeet(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
commands.spawn((
|
||||
Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
|
||||
MeshMaterial3d(materials.add(Color::srgb_u8(255, 255, 255))),
|
||||
Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
));
|
||||
commands.spawn((
|
||||
Mesh3d(meshes.add(Plane3d::new(Vec3::Y, vec2(4., 4.)))),
|
||||
MeshMaterial3d(materials.add(Color::srgb_u8(255, 255, 255))),
|
||||
Transform::from_xyz(0., 0., 0.),
|
||||
));
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
commands.spawn((
|
||||
Camera3d::default(),
|
||||
Transform::from_xyz(-4.5, 3.5, 4.5).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue