From 9d0a79f2fd9cd134d8dfe28b1f6c29db7b064676 Mon Sep 17 00:00:00 2001 From: Joey Pollack Date: Fri, 17 May 2024 14:36:36 -0400 Subject: [PATCH] Adds basic scene with brick in core plugin --- Cargo.lock | 8 ++++++++ Cargo.toml | 2 ++ crates/core/Cargo.toml | 11 +++++++++++ crates/core/src/core.rs | 36 ++++++++++++++++++++++++++++++++++++ crates/core/src/lib.rs | 3 +++ src/main.rs | 4 ++-- 6 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 crates/core/Cargo.toml create mode 100644 crates/core/src/core.rs create mode 100644 crates/core/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 10390c2..42f9b8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1162,6 +1162,7 @@ name = "bricks" version = "0.1.0" dependencies = [ "bevy", + "core", "hello", ] @@ -1375,6 +1376,13 @@ dependencies = [ "const_soft_float", ] +[[package]] +name = "core" +version = "0.1.0" +dependencies = [ + "bevy", +] + [[package]] name = "core-foundation" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 6b684f8..c56affb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,9 +26,11 @@ linker = "rust-lld.exe" [dependencies] hello = { workspace = true } +core = { workspace = true } bevy = { workspace = true } # bevy = { version = "0.13.0", features = ["dynamic_linking"] } [workspace.dependencies] hello = { path = "crates/hello" } +core = { path = "crates/core" } bevy = { version = "0.13.0" } \ No newline at end of file diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml new file mode 100644 index 0000000..509dca3 --- /dev/null +++ b/crates/core/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "core" +description = "The Core Module For the Game" +version = "0.1.0" +edition = "2021" + +[dependencies] +bevy = { workspace = true } + + + diff --git a/crates/core/src/core.rs b/crates/core/src/core.rs new file mode 100644 index 0000000..c1dc75b --- /dev/null +++ b/crates/core/src/core.rs @@ -0,0 +1,36 @@ + +use bevy::{prelude::*, scene::ron::de}; + +pub struct CorePlugin; + +impl Plugin for CorePlugin +{ + fn build(&self, app: &mut App) + { + app.add_systems(Startup, setup); + } +} + +fn setup(mut commands: Commands, server: Res) +{ + // CAMERA + commands.spawn(Camera3dBundle { + transform: Transform::from_xyz(0.0, 0.0, -25.0).looking_at(Vec3::ZERO, Vec3::Y), + ..default() + }); + + // LIGHT + commands.spawn(PointLightBundle { + transform: Transform::from_xyz(0.0, 5.0, -5.0), + ..default() + }); + + // BRICK + let brick_handle: Handle = server.load("brick.glb#Scene0"); + + commands.spawn(SceneBundle { + scene: brick_handle, + transform: Transform::from_xyz(0.0, 0.0, 0.0), + .. default() + }); +} \ No newline at end of file diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs new file mode 100644 index 0000000..14d0377 --- /dev/null +++ b/crates/core/src/lib.rs @@ -0,0 +1,3 @@ + + +pub mod core; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 5345a43..29f4796 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,13 @@ use bevy::prelude::*; -// extern crate hello; use hello::hello::HelloPlugin; +use core::core::CorePlugin; fn main() { App::new() - .add_plugins((DefaultPlugins, HelloPlugin)) + .add_plugins((DefaultPlugins, CorePlugin)) .run(); }