System cleanup
parent
bcf10e416b
commit
d5f0cbd678
|
@ -113,6 +113,8 @@ pub struct Content {
|
|||
|
||||
/// Textures
|
||||
pub textures: Vec<part::texture::Texture>,
|
||||
/// Map strings to texture names.
|
||||
/// This is only necessary because we need to hard-code a few texture names for UI elements.
|
||||
texture_index: HashMap<String, handle::TextureHandle>,
|
||||
/// The texture to use for starfield stars
|
||||
starfield_handle: Option<handle::TextureHandle>,
|
||||
|
@ -127,7 +129,7 @@ pub struct Content {
|
|||
ships: Vec<part::ship::Ship>,
|
||||
|
||||
/// Star systems
|
||||
pub systems: Vec<part::system::System>,
|
||||
systems: Vec<part::system::System>,
|
||||
|
||||
/// Factions
|
||||
factions: Vec<part::faction::Faction>,
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
mod outfits;
|
||||
mod projectile;
|
||||
mod ship;
|
||||
mod system;
|
||||
mod systemobject;
|
||||
|
||||
pub use outfits::{OutfitSet, OutfitStatSum, ShipGun};
|
||||
pub use projectile::Projectile;
|
||||
pub use ship::Ship;
|
||||
pub use system::System;
|
||||
pub use systemobject::SystemObject;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::SystemObject;
|
||||
use crate::content;
|
||||
use crate::SystemObject;
|
||||
use galactica_content as content;
|
||||
use galactica_render::ObjectSprite;
|
||||
|
||||
pub struct System {
|
||||
|
@ -8,13 +8,14 @@ pub struct System {
|
|||
}
|
||||
|
||||
impl System {
|
||||
pub fn new(ct: &content::System) -> Self {
|
||||
pub fn new(ct: &content::Content, handle: content::SystemHandle) -> Self {
|
||||
let sys = ct.get_system(handle);
|
||||
let mut s = System {
|
||||
name: ct.name.clone(),
|
||||
name: sys.name.clone(),
|
||||
bodies: Vec::new(),
|
||||
};
|
||||
|
||||
for o in &ct.objects {
|
||||
for o in &sys.objects {
|
||||
s.bodies.push(SystemObject {
|
||||
pos: o.position,
|
||||
sprite_texture: o.sprite_texture,
|
|
@ -1,6 +1,6 @@
|
|||
use cgmath::{Deg, Point3};
|
||||
|
||||
use crate::content;
|
||||
use galactica_content as content;
|
||||
use galactica_render::ObjectSprite;
|
||||
|
||||
pub struct SystemObject {
|
|
@ -1,8 +1,9 @@
|
|||
use cgmath::{Deg, InnerSpace, Point2};
|
||||
use content::SystemHandle;
|
||||
use std::time::Instant;
|
||||
use winit::event::{ElementState, MouseButton, MouseScrollDelta, TouchPhase, VirtualKeyCode};
|
||||
|
||||
use super::{camera::Camera, system::System};
|
||||
use super::camera::Camera;
|
||||
use crate::{content, inputstatus::InputStatus};
|
||||
use galactica_constants;
|
||||
use galactica_gameobject as object;
|
||||
|
@ -70,7 +71,7 @@ pub struct Game {
|
|||
pub input: InputStatus,
|
||||
pub last_update: Instant,
|
||||
pub player: ShipPhysicsHandle,
|
||||
pub system: System,
|
||||
pub system: object::System,
|
||||
pub camera: Camera,
|
||||
paused: bool,
|
||||
pub time_scale: f32,
|
||||
|
@ -142,7 +143,7 @@ impl Game {
|
|||
pos: (0.0, 0.0).into(),
|
||||
zoom: 500.0,
|
||||
},
|
||||
system: System::new(&ct.systems[0]),
|
||||
system: object::System::new(&ct, SystemHandle { index: 0 }),
|
||||
|
||||
paused: false,
|
||||
time_scale: 1.0,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
//! This module contains high-level game control logic.
|
||||
//! This module is responsible for high-level game control logic.
|
||||
|
||||
mod camera;
|
||||
mod game;
|
||||
mod system;
|
||||
mod systemobject;
|
||||
|
||||
pub use game::Game;
|
||||
pub use systemobject::SystemObject;
|
||||
|
|
Loading…
Reference in New Issue