Slightly improved valid move indicator, title rendered text

main
Elijah C. Voigt 2 years ago
parent 3d6ca40e67
commit a0c50a88c6

BIN
assets/images/title.png (Stored with Git LFS)

Binary file not shown.

@ -150,33 +150,11 @@ invalid = "/sfx/3D/3DInvalidMove"
#################### ####################
# Display3d settings # Display3d settings
#################### ####################
[display3d]
###
# Multi-sample Anti-Aliasing
# https://docs.rs/bevy/0.11.3/bevy/prelude/enum.Msaa.html
# Options: Off, Sample2, Sample4, Sample8
# Requires: display3d.ssoa.quality_level = "Off"
###
msaa = "Sample8"
###
# Enable HDR lighting
###
hdr = true
###
# Screen Space Ambient Occlusion
# https://docs.rs/bevy/0.11.3/bevy/pbr/enum.ScreenSpaceAmbientOcclusionQualityLevel.html
# Options: Off, Low, Medium, High, Ultra
# Requires: display3d.msaa = "Off"
###
ssoa.quality_level = "Off"
[display3d.skybox] [display3d.skybox]
brightness = 100.0 brightness = 500.0
[display3d.environment_map_light] [display3d.environment_map_light]
intensity = 1.0 intensity = 2500.0
[display3d.models] [display3d.models]
assets_file = "models/Martian Chess.glb" assets_file = "models/Martian Chess.glb"
@ -190,9 +168,13 @@ queen_blue = "QueenBlue"
drone_blue = "DroneBlue" drone_blue = "DroneBlue"
pawn_blue = "PawnBlue" pawn_blue = "PawnBlue"
board = "Gameboard" board = "Gameboard"
valid_move = "Valid Move Spot" valid_move = "Valid Move Static"
title = "Title" title = "Title"
[title]
image = "images/title.png"
width_px = 400.0
[display3d.models.animations] [display3d.models.animations]
intro_a = "GameCamIntro1" intro_a = "GameCamIntro1"
intro_b = "GameCamIntro2" intro_b = "GameCamIntro2"
@ -222,49 +204,3 @@ drone_blue = "DroneBluePieceIdle"
drone_red = "DroneRedPieceIdle" drone_red = "DroneRedPieceIdle"
queen_blue = "QueenBluePieceIdle" queen_blue = "QueenBluePieceIdle"
queen_red = "QueenRedPieceIdle" queen_red = "QueenRedPieceIdle"
###
# Fog
# Only seems to affect objects and not skyboxes
###
[display3d.fog]
directional_light_exponent = 1.0
[display3d.fog.color]
Rgba = { red = 0.0, green = 0.0, blue = 0.0, alpha = 1.0 }
[display3d.fog.directional_light_color]
Rgba = { red = 0.0, green = 0.0, blue = 0.0, alpha = 1.0 }
###
# Fog Faloff
# https://docs.rs/bevy/0.11.3/bevy/pbr/enum.FogFalloff.html
###
[display3d.fog.falloff]
Atmospheric = { extinction = [0.0, 0.0, 0.0], inscattering = [0.0, 0.0, 0.0] }
# Examples:
# * Linear = { start = 1.0, end = 10.0 }
# * Exponential = { density = 1.0 }
# * ExponentialSquared = { density = 1.0 }
# * Atmospheric = { extinction = [1.0, 1.0, 1.0], inscattering = [1.0, 1.0, 1.0] }
###
# Display 3D Coloring
###
[display3d.color]
###
# Tonemapping
# https://docs.rs/bevy/0.11.3/bevy/core_pipeline/tonemapping/enum.Tonemapping.html
# Options: None, Reinhard, ReinhardLuminance, AcesFitted, AgX, SomewhatBoringDisplayTransform, TonyMcMapface, BlenderFilmic
###
tonemapping = "BlenderFilmic"
###
# Color grading
# https://docs.rs/bevy/0.11.3/bevy/render/view/struct.ColorGrading.html
###
[display3d.color.grading]
exposure = 1.0
gamma = 1.0
pre_saturation = 1.0
post_saturation = 1.0
[display3d.bloom]
intensity = 0.0

BIN
assets/models/Martian Chess.glb (Stored with Git LFS)

Binary file not shown.

@ -0,0 +1,73 @@
Bevy Anti Aliasing and Screen Effects
TAA: Temporal Anti Aliasing (https://docs.rs/bevy/0.13.2/bevy/core_pipeline/experimental/taa/struct.TemporalAntiAliasSettings.html)
* Component added to camera
* Conflicts with MSAA and FXAA
* Can be "reset" with a bool, but otherwise no settings
* Requires TemporalAntiAliasingPlugin to App.
* Requires the following marker components on Camera:
* DepthPrepass
* MotionVectorPrepass
* TemporalJitter
* Cannot be used with Orthographic camera
MSAA: Multi-Sample Anti-Aliasing (https://docs.rs/bevy/0.13.2/bevy/prelude/enum.Msaa.html)
* Resource set to the number of samples to run for anti-aliasing or "Off"
* Conflicts with FXAA and TAA
* If set to a sample count, conflicts with Msaa and Fxaa
FXAA: Fast Approximate Anti-Aliasing (https://docs.rs/bevy/0.13.2/bevy/core_pipeline/fxaa/struct.Fxaa.html)
* Compnent added to Camera
* Conflicts with MSAA and TAA
* Has the following parameters:
* Enabled
* Edge Threshold and Edge Threshold Min.
* Sensitivity settings ranging from Low to Extreme.
CAS: Contrast Adaptive Sharpening (https://docs.rs/bevy/0.13.2/bevy/core_pipeline/contrast_adaptive_sharpening/struct.ContrastAdaptiveSharpeningSettings.html)
* Component put on camera to enable adaptive sharpening
* Used in combination w/ FXAA or TAA
* Has the following parameters:
* Enabled (bool)
* Sharpening Strength (float 0..1 | default 0.6)
* Denoise (bool)
HDR: High Dynamic Range (https://docs.rs/bevy/0.13.2/bevy/prelude/struct.Camera.html#structfield.hdr)
* Boolean on Camera component
Bloom (https://docs.rs/bevy/0.13.2/bevy/core_pipeline/bloom/struct.BloomSettings.html)
* Component added to camera to configure bloom effects
* Requires HDR to be enabled
* settings:
* Intensity
* Composite Mode: Additive or EnergyConserving
* low_frequency_boost[_curvature]: Likelyhood light will scatter completely sideways
* high_pass_frequency: 0..1 -> scatter angle 0..90
* Bloom Prefilter:
* Threshold: rgb values under this will not contribute to bloom
* How much to blend between threshold and non-threshold values
* 0..1 -> abrupt..fully soft
* range 0..1, default 0.0
Tonemapping (https://docs.rs/bevy/0.13.2/bevy/core_pipeline/tonemapping/enum.Tonemapping.html)
* Component added to camera to configure color tonemapping
* Enum of options with no further configuration
Color Grading (https://docs.rs/bevy/0.13.2/bevy/render/view/struct.ColorGrading.html)
* Component added to camera to control color grading
* Settings:
* Exposure offset measured in stops
* Gamma applied before tonemapping
* pre/post saturation: range 0..1, saturation before/after tonemapping
Fog (https://docs.rs/bevy/0.13.2/bevy/pbr/struct.FogSettings.html)
* Component added to camera
* Settings:
* Color of the Fog
* Directional light of the fog
* Directional light exponent
* Fog Falloff
* Linear, Exponential, ExponentialSquared, Atmospheric
SSAO: Screen Space Ambient Occlusion (https://docs.rs/bevy/0.13.2/bevy/pbr/struct.ScreenSpaceAmbientOcclusionBundle.html)
* Components put on camera to configure SSAO

@ -1,24 +0,0 @@
# Debugging animations not working?
OK so seems like this:
https://github.com/bevyengine/bevy/blob/22e39c4abf6e2fdf99ba0820b3c35db73be71347/crates/bevy_animation/src/lib.rs#L119C12-L122
Printed as this:
```
paths: {
EntityPath {
parts: [
"Queen",
],
}: 0,
},
```
Means the only entity that this will play for is one called "Queen".
Now there are a few hacks we can do.
We can add the `Name("Queen")` to all of our entities but that's BS.
They aren't Queens they are Pawns and Drones.
So why does Bevy think the animation is only associated with Queen and not other entities?

@ -10,10 +10,7 @@ impl Plugin for DebugPlugin {
SystemInformationDiagnosticsPlugin, SystemInformationDiagnosticsPlugin,
)) ))
.init_resource::<DebugInfo>() .init_resource::<DebugInfo>()
// .insert_resource(GizmoConfig { .init_state::<DebugState>()
// depth_bias: -0.1,
// ..default()
// })
.add_systems(Update, (aabb_gizmo,)) .add_systems(Update, (aabb_gizmo,))
// Systems that run in the editor mode // Systems that run in the editor mode
.add_systems( .add_systems(
@ -22,15 +19,15 @@ impl Plugin for DebugPlugin {
selected_gizmo.run_if(any_with_component::<game::Selected>), selected_gizmo.run_if(any_with_component::<game::Selected>),
selected_position.run_if(any_with_component::<game::Selected>), selected_position.run_if(any_with_component::<game::Selected>),
) )
.run_if(resource_exists::<DebugEnabled>), .run_if(in_state(DebugState::Enabled)),
) )
.add_systems(Startup, init_debug_ui) .add_systems(Startup, init_debug_ui)
.add_systems( .add_systems(
Update, Update,
( (
toggle_debug_mode.run_if(on_event::<KeyboardInput>()), toggle_debug_mode.run_if(on_event::<KeyboardInput>()),
display_diagnostics.run_if(resource_exists::<DebugEnabled>), display_diagnostics.run_if(in_state(DebugState::Enabled)),
toggle_debug_ui.run_if(resource_changed_or_removed::<DebugEnabled>()), toggle_debug_ui.run_if(state_changed::<DebugState>),
), ),
); );
} }
@ -58,16 +55,20 @@ impl DebugInfo {
} }
/// Marker resource used to enable Debug mode when present /// Marker resource used to enable Debug mode when present
#[derive(Debug, Resource, Default)] #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default, States)]
pub(crate) struct DebugEnabled; pub(crate) enum DebugState {
#[default]
Disabled,
Enabled,
}
#[derive(Debug, Component)] #[derive(Debug, Component)]
struct DebugRoot; struct DebugRoot;
fn toggle_debug_mode( fn toggle_debug_mode(
mut events: EventReader<KeyboardInput>, mut events: EventReader<KeyboardInput>,
enabled: Option<Res<DebugEnabled>>, current_state: Res<State<DebugState>>,
mut commands: Commands, mut next_state: ResMut<NextState<DebugState>>,
) { ) {
events events
.read() .read()
@ -76,20 +77,20 @@ fn toggle_debug_mode(
state, key_code, .. state, key_code, ..
}| *state == ButtonState::Pressed && *key_code == KeyCode::F3, }| *state == ButtonState::Pressed && *key_code == KeyCode::F3,
) )
.for_each(|_| match enabled { .for_each(|_| match current_state.get() {
Some(_) => commands.remove_resource::<DebugEnabled>(), DebugState::Enabled => next_state.set(DebugState::Disabled),
None => commands.insert_resource(DebugEnabled), DebugState::Disabled => next_state.set(DebugState::Enabled),
}); });
} }
fn toggle_debug_ui( fn toggle_debug_ui(
mut visibility: Query<&mut Visibility, With<DebugRoot>>, mut visibility: Query<&mut Visibility, With<DebugRoot>>,
enabled: Option<Res<DebugEnabled>>, current_state: Res<State<DebugState>>,
) { ) {
visibility.iter_mut().for_each(|mut vis| { visibility.iter_mut().for_each(|mut vis| {
*vis = match enabled { *vis = match current_state.get() {
Some(_) => Visibility::Visible, DebugState::Enabled => Visibility::Visible,
None => Visibility::Hidden, DebugState::Disabled => Visibility::Hidden,
} }
}); });
} }
@ -145,7 +146,7 @@ fn aabb_gizmo(
added: Query<Entity, Added<game::Selected>>, added: Query<Entity, Added<game::Selected>>,
mut removed: RemovedComponents<game::Selected>, mut removed: RemovedComponents<game::Selected>,
selected: Query<Entity, With<game::Selected>>, selected: Query<Entity, With<game::Selected>>,
active: Option<Res<DebugEnabled>>, current_state: Res<State<DebugState>>,
mut commands: Commands, mut commands: Commands,
) { ) {
added.iter().for_each(|e| { added.iter().for_each(|e| {
@ -156,13 +157,13 @@ fn aabb_gizmo(
removed.read().for_each(|e| { removed.read().for_each(|e| {
commands.entity(e).remove::<ShowAabbGizmo>(); commands.entity(e).remove::<ShowAabbGizmo>();
}); });
match active { match current_state.get() {
Some(_) => selected.iter().for_each(|e| { DebugState::Enabled => selected.iter().for_each(|e| {
commands.entity(e).insert(ShowAabbGizmo { commands.entity(e).insert(ShowAabbGizmo {
color: Some(Color::RED), color: Some(Color::RED),
}); });
}), }),
None => selected.iter().for_each(|e| { DebugState::Disabled => selected.iter().for_each(|e| {
commands.entity(e).remove::<ShowAabbGizmo>(); commands.entity(e).remove::<ShowAabbGizmo>();
}), }),
} }

@ -1,3 +1,7 @@
use bevy::core_pipeline::{
bloom::{BloomCompositeMode, BloomPrefilterSettings}, contrast_adaptive_sharpening::ContrastAdaptiveSharpeningSettings, experimental::taa::TemporalAntiAliasBundle, fxaa::{Fxaa, FxaaPlugin, Sensitivity}
};
use crate::prelude::*; use crate::prelude::*;
pub(crate) struct Display3dPlugin; pub(crate) struct Display3dPlugin;
@ -9,6 +13,10 @@ impl Plugin for Display3dPlugin {
MaterialPlugin::<DissolveMaterial>::default(), MaterialPlugin::<DissolveMaterial>::default(),
)) ))
.insert_resource(Msaa::Off) .insert_resource(Msaa::Off)
.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 100.0,
})
.add_systems( .add_systems(
OnExit(GameState::Loading), OnExit(GameState::Loading),
( (
@ -72,7 +80,7 @@ impl Plugin for Display3dPlugin {
moves_gizmo, moves_gizmo,
debug_selected.run_if(any_with_component::<game::Selected>), debug_selected.run_if(any_with_component::<game::Selected>),
) )
.run_if(resource_exists::<debug::DebugEnabled>) .run_if(in_state(debug::DebugState::Enabled))
.run_if(in_state(GameState::Play)) .run_if(in_state(GameState::Play))
.run_if(in_state(DisplayState::Display3d)), .run_if(in_state(DisplayState::Display3d)),
) )
@ -273,10 +281,7 @@ fn hydrate_camera(
let environment_map_intensity = tweak let environment_map_intensity = tweak
.get::<f32>("display3d_environment_map_light_intensity") .get::<f32>("display3d_environment_map_light_intensity")
.unwrap(); .unwrap();
let fog_settings = tweak
.get::<tweaks::TweakFogSettings>("display3d_fog")
.unwrap()
.into();
info!("Hydrating camera {:?}", entity); info!("Hydrating camera {:?}", entity);
// Populate the components for the camera // Populate the components for the camera
commands.entity(entity).insert(( commands.entity(entity).insert((
@ -285,14 +290,14 @@ fn hydrate_camera(
Camera3dBundle { Camera3dBundle {
camera: Camera { camera: Camera {
is_active: true, is_active: true,
hdr: tweak.get::<bool>("display3d_hdr").unwrap(), hdr: true,
..default() ..default()
}, },
dither: DebandDither::Enabled, dither: DebandDither::Enabled,
color_grading: ColorGrading { ..default() }, color_grading: ColorGrading { ..default() },
tonemapping: Tonemapping::BlenderFilmic,
..default() ..default()
}, },
BloomSettings { ..default() },
Skybox { Skybox {
image: skybox_handle.clone(), image: skybox_handle.clone(),
brightness: skybox_brightness, brightness: skybox_brightness,
@ -302,10 +307,31 @@ fn hydrate_camera(
specular_map: skybox_handle.clone(), specular_map: skybox_handle.clone(),
intensity: environment_map_intensity, intensity: environment_map_intensity,
}, },
FogSettings { ..fog_settings }, Fxaa {
ScreenSpaceAmbientOcclusionBundle { ..default() }, enabled: true,
TemporalAntiAliasSettings { ..default() }, ..default()
MotionVectorPrepass, },
ContrastAdaptiveSharpeningSettings {
enabled: false,
..default()
},
BloomSettings {
intensity: 0.05,
prefilter_settings: BloomPrefilterSettings {
threshold: 0.8,
threshold_softness: 0.5,
},
composite_mode: BloomCompositeMode::Additive,
..default()
},
FogSettings {
color: Color::rgba(0.25, 0.25, 0.25, 1.0),
falloff: FogFalloff::Exponential {
density: 0.025,
},
..default()
},
// ScreenSpaceAmbientOcclusionBundle { ..default() },
)); ));
let assets_handle = tweak let assets_handle = tweak
@ -339,81 +365,21 @@ fn hydrate_camera(
/// Update display3d tweaks in the game /// Update display3d tweaks in the game
/// Triggered on entering 3d state and when the tweakfile is updated. /// Triggered on entering 3d state and when the tweakfile is updated.
fn update_tweaks( fn update_tweaks(
mut camera_settings: Query< mut camera_settings: Query<(Entity, &mut Skybox, &mut EnvironmentMapLight), With<Display3d>>,
(
Entity,
&mut FogSettings,
&mut ColorGrading,
&mut Tonemapping,
&mut BloomSettings,
&mut Skybox,
&mut EnvironmentMapLight,
),
With<Display3d>,
>,
tweaks_file: Res<tweak::GameTweaks>, tweaks_file: Res<tweak::GameTweaks>,
tweaks: Res<Assets<Tweaks>>, tweaks: Res<Assets<Tweaks>>,
mut commands: Commands, mut commands: Commands,
) { ) {
if let Some(tweak) = tweaks.get(tweaks_file.handle.clone()) { if let Some(tweak) = tweaks.get(tweaks_file.handle.clone()) {
warn!("Updating tweaks!"); warn!("Updating tweaks!");
camera_settings.iter_mut().for_each( camera_settings
|( .iter_mut()
entity, .for_each(|(entity, mut skybox, mut environment_map_light)| {
mut fog,
mut color_grading,
mut tonemapping,
mut bloom,
mut skybox,
mut environment_map_light,
)| {
*fog = tweak
.get::<tweaks::TweakFogSettings>("display3d_fog")
.unwrap()
.into();
*color_grading = tweak
.get::<tweaks::TweakColorGrading>("display3d_color_grading")
.unwrap()
.into();
*tonemapping = tweak
.get::<tweaks::TweakTonemapping>("display3d_color_tonemapping")
.unwrap()
.into();
*bloom = tweak
.get::<tweaks::TweakBloomSettings>("display3d_bloom")
.unwrap()
.into();
skybox.brightness = tweak.get::<f32>("display3d_skybox_brightness").unwrap(); skybox.brightness = tweak.get::<f32>("display3d_skybox_brightness").unwrap();
environment_map_light.intensity = tweak environment_map_light.intensity = tweak
.get::<f32>("display3d_environment_map_light_intensity") .get::<f32>("display3d_environment_map_light_intensity")
.unwrap(); .unwrap();
let quality_level = tweak
.get::<tweaks::TweakScreenSpaceAmbientOcclusionQualityLevel>(
"display3d_ssao_quality_level",
);
match quality_level {
Some(quality_level) => {
commands
.entity(entity)
.insert(ScreenSpaceAmbientOcclusionSettings {
quality_level: quality_level.into(),
}); });
commands.insert_resource(Msaa::Off);
}
None => {
commands
.entity(entity)
.remove::<ScreenSpaceAmbientOcclusionSettings>();
let msaa: Msaa = tweak
.get::<tweaks::TweakMsaa>("display3d_msaa")
.unwrap()
.into();
commands.insert_resource(msaa);
}
}
},
);
} }
} }
@ -1000,178 +966,6 @@ fn switch_sides(
}); });
} }
pub(super) mod tweaks {
use super::*;
#[derive(Debug, Deserialize)]
pub enum TweakTonemapping {
None,
Reinhard,
ReinhardLuminance,
AcesFitted,
AgX,
SomewhatBoringDisplayTransform,
TonyMcMapface,
BlenderFilmic,
}
impl From<TweakTonemapping> for Tonemapping {
fn from(src: TweakTonemapping) -> Tonemapping {
match src {
TweakTonemapping::None => Tonemapping::None,
TweakTonemapping::Reinhard => Tonemapping::Reinhard,
TweakTonemapping::ReinhardLuminance => Tonemapping::ReinhardLuminance,
TweakTonemapping::AcesFitted => Tonemapping::AcesFitted,
TweakTonemapping::AgX => Tonemapping::AgX,
TweakTonemapping::SomewhatBoringDisplayTransform => {
Tonemapping::SomewhatBoringDisplayTransform
}
TweakTonemapping::TonyMcMapface => Tonemapping::TonyMcMapface,
TweakTonemapping::BlenderFilmic => Tonemapping::BlenderFilmic,
}
}
}
#[derive(Debug, Deserialize)]
pub struct TweakBloomSettings {
intensity: f32,
}
impl From<TweakBloomSettings> for BloomSettings {
fn from(src: TweakBloomSettings) -> BloomSettings {
BloomSettings {
intensity: src.intensity,
..default()
}
}
}
#[derive(Debug, Deserialize)]
pub enum TweakMsaa {
Off,
Sample2,
Sample4,
Sample8,
}
impl From<TweakMsaa> for Msaa {
fn from(src: TweakMsaa) -> Msaa {
match src {
TweakMsaa::Off => Msaa::Off,
TweakMsaa::Sample2 => Msaa::Sample2,
TweakMsaa::Sample4 => Msaa::Sample4,
TweakMsaa::Sample8 => Msaa::Sample8,
}
}
}
#[derive(Deserialize, Debug)]
pub enum TweakScreenSpaceAmbientOcclusionQualityLevel {
Low,
Medium,
High,
Ultra,
}
impl From<TweakScreenSpaceAmbientOcclusionQualityLevel>
for ScreenSpaceAmbientOcclusionQualityLevel
{
fn from(
src: TweakScreenSpaceAmbientOcclusionQualityLevel,
) -> ScreenSpaceAmbientOcclusionQualityLevel {
match src {
TweakScreenSpaceAmbientOcclusionQualityLevel::Low => {
ScreenSpaceAmbientOcclusionQualityLevel::Low
}
TweakScreenSpaceAmbientOcclusionQualityLevel::Medium => {
ScreenSpaceAmbientOcclusionQualityLevel::Medium
}
TweakScreenSpaceAmbientOcclusionQualityLevel::High => {
ScreenSpaceAmbientOcclusionQualityLevel::High
}
TweakScreenSpaceAmbientOcclusionQualityLevel::Ultra => {
ScreenSpaceAmbientOcclusionQualityLevel::Ultra
}
}
}
}
#[derive(Debug, Deserialize)]
pub struct TweakFogSettings {
pub color: Color,
pub directional_light_color: Color,
pub directional_light_exponent: f32,
pub falloff: TweakFogFalloff,
}
impl From<TweakFogSettings> for FogSettings {
fn from(src: TweakFogSettings) -> FogSettings {
FogSettings {
color: src.color,
directional_light_color: src.directional_light_color,
directional_light_exponent: src.directional_light_exponent,
falloff: src.falloff.into(),
}
}
}
#[derive(Debug, Deserialize)]
pub enum TweakFogFalloff {
Linear {
start: f32,
end: f32,
},
Exponential {
density: f32,
},
ExponentialSquared {
density: f32,
},
Atmospheric {
extinction: Vec3,
inscattering: Vec3,
},
}
impl From<TweakFogFalloff> for FogFalloff {
fn from(src: TweakFogFalloff) -> FogFalloff {
match src {
TweakFogFalloff::Linear { start, end } => FogFalloff::Linear { start, end },
TweakFogFalloff::Exponential { density } => FogFalloff::Exponential { density },
TweakFogFalloff::ExponentialSquared { density } => {
FogFalloff::ExponentialSquared { density }
}
TweakFogFalloff::Atmospheric {
extinction,
inscattering,
} => FogFalloff::Atmospheric {
extinction,
inscattering,
},
}
}
}
#[derive(Debug, Deserialize)]
pub struct TweakColorGrading {
pub exposure: f32,
pub gamma: f32,
pub pre_saturation: f32,
pub post_saturation: f32,
}
impl From<TweakColorGrading> for ColorGrading {
fn from(src: TweakColorGrading) -> ColorGrading {
ColorGrading {
exposure: src.exposure,
gamma: src.gamma,
pre_saturation: src.pre_saturation,
post_saturation: src.post_saturation,
}
}
}
}
/// Type expressing the extended material of standardMaterial + dissolveMaterial /// Type expressing the extended material of standardMaterial + dissolveMaterial
type DissolveMaterial = ExtendedMaterial<StandardMaterial, DissolveExtension>; type DissolveMaterial = ExtendedMaterial<StandardMaterial, DissolveExtension>;

@ -40,7 +40,7 @@ impl Plugin for GamePlugin {
) )
.add_systems( .add_systems(
PostUpdate, PostUpdate,
(debug_board.run_if(resource_exists::<debug::DebugEnabled>),), (debug_board.run_if(in_state(debug::DebugState::Enabled)),),
) )
.add_systems(OnEnter(GameState::Restart), handle_restart) .add_systems(OnEnter(GameState::Restart), handle_restart)
.add_systems(OnEnter(GameState::Quit), handle_quit); .add_systems(OnEnter(GameState::Quit), handle_quit);

@ -49,6 +49,8 @@ fn init_play_menu(
let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks"); let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks");
let button_handle = tweak.get_handle::<Image>("buttons_image_resting").unwrap(); let button_handle = tweak.get_handle::<Image>("buttons_image_resting").unwrap();
let font_handle = tweak.get_handle::<Font>("buttons_font").unwrap(); let font_handle = tweak.get_handle::<Font>("buttons_font").unwrap();
let title_handle = tweak.get_handle::<Image>("title_image").unwrap();
let title_width_px = tweak.get::<f32>("title_width_px").unwrap();
commands commands
.spawn(( .spawn((
@ -70,14 +72,17 @@ fn init_play_menu(
)) ))
.with_children(|parent| { .with_children(|parent| {
// Title // Title
parent.spawn((TextBundle::from_section( parent.spawn(ImageBundle {
"M A R T I A N C H E S S", style: Style {
TextStyle { width: Val::Px(title_width_px),
font_size: 48.0, ..default()
color: Color::ORANGE_RED, },
image: UiImage {
texture: title_handle.clone(),
..default() ..default()
}, },
),)); ..default()
});
// Continue button // Continue button
parent parent
@ -86,8 +91,8 @@ fn init_play_menu(
ButtonAction(MenuState::Off), ButtonAction(MenuState::Off),
ButtonBundle { ButtonBundle {
style: Style { style: Style {
padding: UiRect::all(Val::Px(5.0)), padding: UiRect::all(Val::Px(2.0)),
margin: UiRect::all(Val::Px(5.0)), margin: UiRect::all(Val::Px(2.0)),
..default() ..default()
}, },
image: UiImage { image: UiImage {
@ -104,14 +109,14 @@ fn init_play_menu(
value: "C o n t i n u e".into(), value: "C o n t i n u e".into(),
style: TextStyle { style: TextStyle {
color: Color::WHITE, color: Color::WHITE,
font_size: 16.0, font_size: 12.0,
font: font_handle.clone(), font: font_handle.clone(),
}, },
}], }],
..default() ..default()
}, },
style: Style { style: Style {
margin: UiRect::all(Val::Px(20.0)), margin: UiRect::all(Val::Px(10.0)),
..default() ..default()
}, },
..default() ..default()
@ -125,8 +130,8 @@ fn init_play_menu(
ButtonAction(MenuState::Off), ButtonAction(MenuState::Off),
ButtonBundle { ButtonBundle {
style: Style { style: Style {
padding: UiRect::all(Val::Px(5.0)), padding: UiRect::all(Val::Px(2.0)),
margin: UiRect::all(Val::Px(5.0)), margin: UiRect::all(Val::Px(2.0)),
..default() ..default()
}, },
image: UiImage { image: UiImage {
@ -143,14 +148,14 @@ fn init_play_menu(
value: "R e s t a r t".into(), value: "R e s t a r t".into(),
style: TextStyle { style: TextStyle {
color: Color::WHITE, color: Color::WHITE,
font_size: 16.0, font_size: 12.0,
font: font_handle.clone(), font: font_handle.clone(),
}, },
}], }],
..default() ..default()
}, },
style: Style { style: Style {
margin: UiRect::all(Val::Px(20.0)), margin: UiRect::all(Val::Px(10.0)),
..default() ..default()
}, },
..default() ..default()
@ -164,8 +169,8 @@ fn init_play_menu(
ButtonAction(MenuState::Off), ButtonAction(MenuState::Off),
ButtonBundle { ButtonBundle {
style: Style { style: Style {
padding: UiRect::all(Val::Px(5.0)), padding: UiRect::all(Val::Px(2.0)),
margin: UiRect::all(Val::Px(5.0)), margin: UiRect::all(Val::Px(2.0)),
..default() ..default()
}, },
image: UiImage { image: UiImage {
@ -182,14 +187,14 @@ fn init_play_menu(
value: "T u t o r i a l".into(), value: "T u t o r i a l".into(),
style: TextStyle { style: TextStyle {
color: Color::WHITE, color: Color::WHITE,
font_size: 16.0, font_size: 12.0,
font: font_handle.clone(), font: font_handle.clone(),
}, },
}], }],
..default() ..default()
}, },
style: Style { style: Style {
margin: UiRect::all(Val::Px(20.0)), margin: UiRect::all(Val::Px(10.0)),
..default() ..default()
}, },
..default() ..default()
@ -203,8 +208,8 @@ fn init_play_menu(
ButtonAction(MenuState::Off), ButtonAction(MenuState::Off),
ButtonBundle { ButtonBundle {
style: Style { style: Style {
padding: UiRect::all(Val::Px(5.0)), padding: UiRect::all(Val::Px(2.0)),
margin: UiRect::all(Val::Px(5.0)), margin: UiRect::all(Val::Px(2.0)),
..default() ..default()
}, },
image: UiImage { image: UiImage {
@ -221,14 +226,14 @@ fn init_play_menu(
value: "C r e d i t s".into(), value: "C r e d i t s".into(),
style: TextStyle { style: TextStyle {
color: Color::WHITE, color: Color::WHITE,
font_size: 16.0, font_size: 12.0,
font: font_handle.clone(), font: font_handle.clone(),
}, },
}], }],
..default() ..default()
}, },
style: Style { style: Style {
margin: UiRect::all(Val::Px(20.0)), margin: UiRect::all(Val::Px(10.0)),
..default() ..default()
}, },
..default() ..default()
@ -242,8 +247,8 @@ fn init_play_menu(
ButtonAction(MenuState::Off), ButtonAction(MenuState::Off),
ButtonBundle { ButtonBundle {
style: Style { style: Style {
padding: UiRect::all(Val::Px(5.0)), padding: UiRect::all(Val::Px(2.0)),
margin: UiRect::all(Val::Px(5.0)), margin: UiRect::all(Val::Px(2.0)),
..default() ..default()
}, },
image: UiImage { image: UiImage {
@ -260,14 +265,14 @@ fn init_play_menu(
value: "Q u i t".into(), value: "Q u i t".into(),
style: TextStyle { style: TextStyle {
color: Color::WHITE, color: Color::WHITE,
font_size: 16.0, font_size: 12.0,
font: font_handle.clone(), font: font_handle.clone(),
}, },
}], }],
..default() ..default()
}, },
style: Style { style: Style {
margin: UiRect::all(Val::Px(20.0)), margin: UiRect::all(Val::Px(10.0)),
..default() ..default()
}, },
..default() ..default()

Loading…
Cancel
Save