From 613ed710a2dc71acee4dcac8078faf799bfe2621 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Mon, 17 Apr 2023 20:15:43 +0200 Subject: [PATCH] more --- src/app.rs | 30 +++--------------------------- src/tiles.rs | 18 +----------------- src/worldgen.rs | 11 ++++++----- tiles.rs | 18 +----------------- 4 files changed, 11 insertions(+), 66 deletions(-) diff --git a/src/app.rs b/src/app.rs index ca30538..d8e1265 100644 --- a/src/app.rs +++ b/src/app.rs @@ -77,19 +77,8 @@ impl App { let mut rst = RenderStates::default(); rst.blend_mode = BlendMode::MULTIPLY; self.light_map.display(); - spr.set_texture(self.light_map.texture(), false); - self.rw.draw_with_renderstates(&spr, &rst); - drop(spr); - self.rt.clear(Color::TRANSPARENT); - let ui_dims = Vector2 { - x: (self.rw.size().x / self.scale as u32) as f32, - y: (self.rw.size().y / self.scale as u32) as f32, - }; - self.game.draw_ui(&mut self.rt, &self.res, ui_dims); - self.rt.display(); - let mut spr = Sprite::with_texture(self.rt.texture()); - spr.set_scale((self.scale as f32, self.scale as f32)); - self.rw.draw(&spr); + + self.sf_egui .do_frame(|ctx| { debug::do_debug_ui( @@ -102,20 +91,7 @@ impl App { ); }) .unwrap(); - if self.debug.show_atlas { - let atlas = &self.res.atlas.tex; - let size = atlas.size(); - let mut rs = RectangleShape::from_rect( - Rect::new(0., 0., size.x as f32, size.y as f32), - ); - rs.set_fill_color(Color::MAGENTA); - self.rw.draw(&rs); - self.rw.draw(&Sprite::with_texture(atlas)); - } - self.sf_egui.draw(&mut self.rw, None); - self.rw.display(); - drop(spr); - self.execute_commands(); + } fn execute_commands(&mut self) { loop {} diff --git a/src/tiles.rs b/src/tiles.rs index c90b74a..9388be1 100644 --- a/src/tiles.rs +++ b/src/tiles.rs @@ -5,11 +5,7 @@ use std::{fmt::Debug, marker::PhantomData, ops::Index}; use egui_inspect::{derive::Inspect, Inspect}; use serde::{Deserialize, Serialize}; -use crate::{ - graphics::ScreenVec, - math::{IntRect, TILE_SIZE}, - texture_atlas::RectMap, -}; +use crate::{math::TILE_SIZE, texture_atlas::RectMap}; #[derive(Inspect, PartialEq, Eq)] pub struct TileId(pub u16, PhantomData); @@ -103,9 +99,6 @@ where Layer::SpecificDef: Debug + Inspect, { /// Whether the tile emits light, and the light source offset - pub light: Option, - pub graphic_name: String, - pub tex_rect: IntRect, pub layer: Layer::SpecificDef, //ADD pub blend_graphic: String, } @@ -212,12 +205,3 @@ where { loop {} } - -fn update_rect_def( - def: &mut TileDef, - rects: &std::collections::HashMap, -) where - Layer::SpecificDef: Debug + Inspect, -{ - loop {} -} diff --git a/src/worldgen.rs b/src/worldgen.rs index 1573e58..50a6cbb 100644 --- a/src/worldgen.rs +++ b/src/worldgen.rs @@ -1,13 +1,14 @@ +use crate::{ + tiles::{BgTileId, FgTileId, MidTileId, TileId}, + world::{ChunkPos, Tile as Tl, CHUNK_EXTENT}, +}; use worldgen::{ - constraint, noise::perlin::PerlinNoise, + constraint, + noise::perlin::PerlinNoise, noisemap::{NoiseMap, NoiseMapGenerator, Seed, Step}, world::{ tile::{Constraint, ConstraintType}, Size, Tile, World, }, }; -use crate::{ - tiles::{BgTileId, FgTileId, MidTileId, TileId}, - world::{ChunkPos, Tile as Tl, CHUNK_EXTENT}, -}; pub(crate) struct Worldgen {} diff --git a/tiles.rs b/tiles.rs index c90b74a..9388be1 100644 --- a/tiles.rs +++ b/tiles.rs @@ -5,11 +5,7 @@ use std::{fmt::Debug, marker::PhantomData, ops::Index}; use egui_inspect::{derive::Inspect, Inspect}; use serde::{Deserialize, Serialize}; -use crate::{ - graphics::ScreenVec, - math::{IntRect, TILE_SIZE}, - texture_atlas::RectMap, -}; +use crate::{math::TILE_SIZE, texture_atlas::RectMap}; #[derive(Inspect, PartialEq, Eq)] pub struct TileId(pub u16, PhantomData); @@ -103,9 +99,6 @@ where Layer::SpecificDef: Debug + Inspect, { /// Whether the tile emits light, and the light source offset - pub light: Option, - pub graphic_name: String, - pub tex_rect: IntRect, pub layer: Layer::SpecificDef, //ADD pub blend_graphic: String, } @@ -212,12 +205,3 @@ where { loop {} } - -fn update_rect_def( - def: &mut TileDef, - rects: &std::collections::HashMap, -) where - Layer::SpecificDef: Debug + Inspect, -{ - loop {} -}