diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 315d11ea27834bf63190890d4f0e60ce59c3bf03..d45c4a4c3657a1eccee69d82e887a968ffa13fd0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,7 +26,7 @@ build-windows: artifacts: expire_in: 1 day paths: - - target/x86_64-pc-windows-gnu/release/${BINARY_NAME}.exe + - target/x86_64-pc-windows-gnu/release/game_core.exe only: - trunk @@ -48,7 +48,7 @@ build-linux: artifacts: expire_in: 1 day paths: - - target/x86_64-unknown-linux-gnu/release/${BINARY_NAME} + - target/x86_64-unknown-linux-gnu/release/game_core only: - trunk @@ -73,7 +73,7 @@ build-arm64: artifacts: expire_in: 1 day paths: - - target/aarch64-unknown-linux-gnu/release/${BINARY_NAME} + - target/aarch64-unknown-linux-gnu/release/game_core only: - trunk @@ -100,7 +100,7 @@ build-web: artifacts: expire_in: 1 day paths: - - ${BINARY_FOLDER}/dist/ + - game_core/dist/ only: - trunk diff --git a/Cargo.lock b/Cargo.lock index c6a7a85644c45f372625dd7611cb550d0849bd55..4ba8122bc2c36984d99a37de0bd55c8320abe631 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -415,6 +415,7 @@ dependencies = [ "bevy_ecs", "bevy_math", "bevy_utils", + "serde", ] [[package]] diff --git a/assets/jamsplash.png b/assets/jamsplash.png index 8a600a306df9de611549a2d31f648060876a5d39..f1dad4f51a4c3a698c146e69ff72011f077b33df 100644 --- a/assets/jamsplash.png +++ b/assets/jamsplash.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d9461d43ff1217e0911bb400582db3e300ff0c0365572da4192728d44d251db -size 112087 +oid sha256:8b77c446b6fcd749257c724fae63af953f424930caedec8e32b3a8f498ad2c21 +size 112360 diff --git a/assets/kenney_blocks.ttf b/assets/kenney_blocks.ttf new file mode 100644 index 0000000000000000000000000000000000000000..059ebf3c09541d6fbaf9d6d6f0ccda6431dcea6c --- /dev/null +++ b/assets/kenney_blocks.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb2f9ba39f4fa7d8dbb3d3d1af05c2517b848f278bbe4f7ab53e518f2429bad5 +size 30508 diff --git a/game_core/Cargo.toml b/game_core/Cargo.toml index 02656c7666eade5f4b45921fb90986a068ce50f6..664ed9ca81ee40a6588b39c2043660b8bdf9befe 100644 --- a/game_core/Cargo.toml +++ b/game_core/Cargo.toml @@ -35,4 +35,5 @@ features = [ "png", "hdr", "x11", + "serialize", ] diff --git a/game_core/src/assets/startup.rs b/game_core/src/assets/startup.rs index 7013a56fa9918855a67a1a5e07b6ad69b93cee4b..d4154767b870b2a57ed66f4c3be2302050468b37 100644 --- a/game_core/src/assets/startup.rs +++ b/game_core/src/assets/startup.rs @@ -14,6 +14,7 @@ pub fn start_preload_resources(mut commands: Commands) { pub fn start_load_resources(mut loader: AssetTypeLoader) { loader.load_images(&[("jamsplash.png", "splash")]); loader.load_audio(&[("splash_sting.mp3", "splash_sting")]); + loader.load_font(&[("kenney_blocks.ttf", "blocks")]); } pub fn check_load_resources(mut commands: Commands, loader: AssetTypeLoader) { diff --git a/game_core/src/main.rs b/game_core/src/main.rs index f8a6d3a4f666dda2c46444d068d5a00463e6a1f5..9c372eac3e2f3288532adf906942d0f51ffc2703 100644 --- a/game_core/src/main.rs +++ b/game_core/src/main.rs @@ -18,5 +18,6 @@ fn main() { game_core::multiplayer::OutgoingEvent, game_core::multiplayer::IncomingEvent, >::new()) + .add_plugin(game_core::system::debug::DebugTextBundle) .run(); } diff --git a/game_core/src/system/debug.rs b/game_core/src/system/debug.rs new file mode 100644 index 0000000000000000000000000000000000000000..6e118c915b1557a0584a6310baa5f9cc8e7938e1 --- /dev/null +++ b/game_core/src/system/debug.rs @@ -0,0 +1,63 @@ +use bevy::prelude::*; +use iyes_loopless::prelude::AppLooplessStateExt; + +use crate::assets::AssetHandles; +use crate::system::flow::AppState; +use crate::system::utilities::TRANSPARENT; + +#[derive(Component)] +pub struct Character; + +pub fn create_debug_text(mut commands: Commands, assets: Res<AssetHandles>) { + commands + .spawn_bundle(NodeBundle { + style: Style { + position_type: PositionType::Absolute, + size: Size::new(Val::Percent(100.0), Val::Percent(100.0)), + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, + ..Default::default() + }, + color: TRANSPARENT.into(), + ..Default::default() + }) + .with_children(|children| { + children + .spawn_bundle(TextBundle { + text: Text::from_section( + " ", + TextStyle { + color: Color::WHITE, + font_size: 48.0, + font: assets.font("blocks"), + }, + ), + ..Default::default() + }) + .insert(Character); + }); +} + +pub fn set_last_character( + input: Res<Input<KeyCode>>, + mut query: Query<&mut Text, With<Character>>, +) { + let last_key = input + .get_just_released() + .map(|key| format!("{:?}", key)) + .reduce(|acc, current| format!("{}, {}", acc, current)); + + if let Some(last_key) = last_key { + for mut text in &mut query { + text.sections[0].value = last_key.clone(); + } + } +} + +pub struct DebugTextBundle; +impl Plugin for DebugTextBundle { + fn build(&self, app: &mut App) { + app.add_enter_system(AppState::Menu, create_debug_text) + .add_system(set_last_character); + } +} diff --git a/game_core/src/system/mod.rs b/game_core/src/system/mod.rs index 309ab329d7595034fdc2a5fcbbe46f67f4859192..4e12c889ee422d3992143189266d955c553d2ff4 100644 --- a/game_core/src/system/mod.rs +++ b/game_core/src/system/mod.rs @@ -1,4 +1,5 @@ pub mod camera; +pub mod debug; pub mod flow; pub mod load_config; pub mod resources; diff --git a/game_core/src/system/resources.rs b/game_core/src/system/resources.rs index 7798b37f9259dd483d114cb581dae22ba3ba3fd9..497327961bfdcb43d3965df1bb74bc5080c3d0d1 100644 --- a/game_core/src/system/resources.rs +++ b/game_core/src/system/resources.rs @@ -19,7 +19,7 @@ impl Plugin for DefaultResourcesPlugin { } else { WindowMode::Windowed }, - title: String::from("Bevy 2D Template"), + title: String::from("Realm Fantastique"), present_mode: PresentMode::AutoNoVsync, ..Default::default() }) diff --git a/game_core/src/system/utilities.rs b/game_core/src/system/utilities.rs index 0244a876e4e91ca99e6e4935d84ac387b8b956fb..6a0fcab5571d09035e911721e6ee63c71351ab09 100644 --- a/game_core/src/system/utilities.rs +++ b/game_core/src/system/utilities.rs @@ -1,3 +1,5 @@ +use bevy::prelude::Color; + #[inline] pub fn f32_max(a: f32, b: f32) -> f32 { if a > b { @@ -30,3 +32,5 @@ pub fn f32_min_mag(a: f32, b: f32) -> f32 { b.abs() } } + +pub const TRANSPARENT: Color = Color::rgba(0.0, 0.0, 0.0, 0.0);