From: Tomas Wenström Date: Sat, 13 Feb 2021 16:59:18 +0000 (+0100) Subject: Moved geometry to root level X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=953b4c960649b82f4e186c2a9afee5367270f0fc;p=kaka%2Frust-sdl-test.git Moved geometry to root level --- diff --git a/src/boll.rs b/src/boll.rs index 5d09563..07c7b28 100644 --- a/src/boll.rs +++ b/src/boll.rs @@ -1,8 +1,7 @@ use core::render::Renderer; -use sdl2::rect::Rect; - -use common::Point; +use geometry::Point; use sdl2::gfx::primitives::DrawRenderer; +use sdl2::rect::Rect; use {SCREEN_HEIGHT, SCREEN_WIDTH}; pub trait Boll { diff --git a/src/common/mod.rs b/src/common/mod.rs index 592bdbb..36d3193 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,13 +1,3 @@ -mod geometry; -pub use common::geometry::{ - Point, - Dimension, - Angle, - ToAngle, - Intersection, - supercover_line, -}; - mod time; pub use common::time::ScopeTimer; diff --git a/src/core/app.rs b/src/core/app.rs index 8bed04c..f5452fd 100644 --- a/src/core/app.rs +++ b/src/core/app.rs @@ -1,7 +1,7 @@ use boll::*; -use common::{Point, Dimension}; use core::controller::ControllerManager; use core::render::Renderer; +use geometry::{Point, Dimension}; use point; // defined in common, but loaded from main... use rand::Rng; use sdl2::event::{Event, WindowEvent}; diff --git a/src/core/controller.rs b/src/core/controller.rs index 3cbe391..de91928 100644 --- a/src/core/controller.rs +++ b/src/core/controller.rs @@ -1,4 +1,4 @@ -use common::{Angle, Point}; +use geometry::{Angle, Point}; use {hashmap, point}; use sdl2::HapticSubsystem; use sdl2::JoystickSubsystem; diff --git a/src/core/game.rs b/src/core/game.rs index 9d51e18..3a8d3c9 100644 --- a/src/core/game.rs +++ b/src/core/game.rs @@ -1,11 +1,10 @@ -use teststate::TestState; use AppState; -use common::{Point, ToAngle}; use core::app::StateChange; use core::controller::Controller; use core::controller::ControllerManager; use core::level::{Level, LevelGenerator, Wall, IntersectResult::Intersection}; use core::render::Renderer; +use geometry::{Point, ToAngle}; use point; use sdl2::event::Event; use sdl2::joystick::PowerLevel; @@ -14,6 +13,7 @@ use sdl2::rect::Rect; use sprites::SpriteManager; use std::cell::RefCell; use std::rc::Rc; +use teststate::TestState; use time::Duration; ////////// GAMESTATE /////////////////////////////////////////////////////////// diff --git a/src/core/level/lvlgen.rs b/src/core/level/lvlgen.rs index 8cdf6df..af6ab76 100644 --- a/src/core/level/lvlgen.rs +++ b/src/core/level/lvlgen.rs @@ -1,4 +1,4 @@ -use common::{Point, Dimension}; +use geometry::{Point, Dimension}; use noise::{NoiseFn, OpenSimplex, Seedable}; use rand::Rng; use super::{Grid, Level, WallRegion}; diff --git a/src/core/level/mod.rs b/src/core/level/mod.rs index 578a94e..c2eb041 100644 --- a/src/core/level/mod.rs +++ b/src/core/level/mod.rs @@ -1,5 +1,5 @@ -use common::{Point, Dimension, Intersection, Angle, ToAngle, supercover_line}; use core::render::Renderer; +use geometry::{Point, Dimension, Intersection, Angle, ToAngle, supercover_line}; use sprites::SpriteManager; use std::rc::Rc; use {point, dimen}; diff --git a/src/common/geometry.rs b/src/geometry.rs similarity index 100% rename from src/common/geometry.rs rename to src/geometry.rs diff --git a/src/main.rs b/src/main.rs index a068a58..4a88954 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,12 +6,12 @@ extern crate noise; use core::game::GameState; use core::app::*; -mod teststate; -mod core; -#[macro_use] -mod common; mod boll; +mod common; +mod core; +mod geometry; mod sprites; +mod teststate; const SCREEN_WIDTH: u16 = 1280; const SCREEN_HEIGHT: u16 = (SCREEN_WIDTH as f64 * (1440.0 / 2560.0)) as u16; diff --git a/src/teststate.rs b/src/teststate.rs index 3437164..82acb79 100644 --- a/src/teststate.rs +++ b/src/teststate.rs @@ -1,12 +1,12 @@ -use common::{Dimension, Point, Intersection}; use core::app::{AppState, StateChange}; use core::controller::ControllerManager; use core::level::Grid; use core::render::Renderer; -use {point, dimen}; +use geometry::{Dimension, Point, Intersection}; use sdl2::event::Event; use sprites::SpriteManager; use time::{Duration, Instant}; +use {point, dimen}; pub struct TestState { start: Instant,