cleaned up
This commit is contained in:
parent
161235248b
commit
f84db61a7b
22
src/main.rs
22
src/main.rs
|
@ -40,9 +40,6 @@ struct Sky {
|
||||||
content: Vec<Constellation>,
|
content: Vec<Constellation>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource, Default)]
|
|
||||||
struct ShowConstellationEvent(bool);
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
struct Constellation {
|
struct Constellation {
|
||||||
#[serde(rename = "Name")]
|
#[serde(rename = "Name")]
|
||||||
|
@ -85,7 +82,6 @@ fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.insert_resource(Sky::default())
|
.insert_resource(Sky::default())
|
||||||
.insert_resource(ShowConstellationEvent::default())
|
|
||||||
.add_systems(Startup, star_setup)
|
.add_systems(Startup, star_setup)
|
||||||
.add_systems(Startup, cons_setup)
|
.add_systems(Startup, cons_setup)
|
||||||
.add_systems(Startup, ui_setup)
|
.add_systems(Startup, ui_setup)
|
||||||
|
@ -99,15 +95,23 @@ fn spawn_cons_lines(
|
||||||
mut meshes: ResMut<Assets<Mesh>>,
|
mut meshes: ResMut<Assets<Mesh>>,
|
||||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||||
sky: Res<Sky>,
|
sky: Res<Sky>,
|
||||||
constellation_name: String,
|
target_constellation_name: String,
|
||||||
) {
|
) {
|
||||||
info!("show : {}", constellation_name);
|
|
||||||
// Create a material for the line
|
// Create a material for the line
|
||||||
let line_material = materials.add(StandardMaterial {
|
let line_material = materials.add(StandardMaterial {
|
||||||
emissive: LinearRgba::rgb(1.0, 0.5, 0.5), // Red color for the line
|
emissive: LinearRgba::rgb(1.0, 0.5, 0.5), // Red color for the line
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let mut target_constellation = sky.content[0].clone();
|
||||||
|
for constellation in sky.content.clone() {
|
||||||
|
if constellation.name == target_constellation_name {
|
||||||
|
target_constellation = constellation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
info!("show : {}", target_constellation.name);
|
||||||
|
|
||||||
// Define vertices for the line (two points in 3D space)
|
// Define vertices for the line (two points in 3D space)
|
||||||
let vertices = vec![
|
let vertices = vec![
|
||||||
[-1.0, -1.0, 0.0], // Starting point (origin)
|
[-1.0, -1.0, 0.0], // Starting point (origin)
|
||||||
|
@ -381,9 +385,9 @@ fn button_system(
|
||||||
>,
|
>,
|
||||||
mut text_query: Query<&mut Text, With<AnswerButton>>,
|
mut text_query: Query<&mut Text, With<AnswerButton>>,
|
||||||
mut player_query: Query<&mut Player>,
|
mut player_query: Query<&mut Player>,
|
||||||
mut commands: Commands,
|
commands: Commands,
|
||||||
mut meshes: ResMut<Assets<Mesh>>,
|
meshes: ResMut<Assets<Mesh>>,
|
||||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
materials: ResMut<Assets<StandardMaterial>>,
|
||||||
sky: Res<Sky>,
|
sky: Res<Sky>,
|
||||||
) {
|
) {
|
||||||
let mut pressed_button: Option<String> = None;
|
let mut pressed_button: Option<String> = None;
|
||||||
|
|
Loading…
Reference in a new issue