mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 19:55:02 +01:00
more
This commit is contained in:
parent
46881771b8
commit
613ed710a2
4 changed files with 11 additions and 66 deletions
30
src/app.rs
30
src/app.rs
|
|
@ -77,19 +77,8 @@ impl App {
|
||||||
let mut rst = RenderStates::default();
|
let mut rst = RenderStates::default();
|
||||||
rst.blend_mode = BlendMode::MULTIPLY;
|
rst.blend_mode = BlendMode::MULTIPLY;
|
||||||
self.light_map.display();
|
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
|
self.sf_egui
|
||||||
.do_frame(|ctx| {
|
.do_frame(|ctx| {
|
||||||
debug::do_debug_ui(
|
debug::do_debug_ui(
|
||||||
|
|
@ -102,20 +91,7 @@ impl App {
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.unwrap();
|
.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) {
|
fn execute_commands(&mut self) {
|
||||||
loop {}
|
loop {}
|
||||||
|
|
|
||||||
18
src/tiles.rs
18
src/tiles.rs
|
|
@ -5,11 +5,7 @@ use std::{fmt::Debug, marker::PhantomData, ops::Index};
|
||||||
use egui_inspect::{derive::Inspect, Inspect};
|
use egui_inspect::{derive::Inspect, Inspect};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{math::TILE_SIZE, texture_atlas::RectMap};
|
||||||
graphics::ScreenVec,
|
|
||||||
math::{IntRect, TILE_SIZE},
|
|
||||||
texture_atlas::RectMap,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Inspect, PartialEq, Eq)]
|
#[derive(Inspect, PartialEq, Eq)]
|
||||||
pub struct TileId<Layer>(pub u16, PhantomData<Layer>);
|
pub struct TileId<Layer>(pub u16, PhantomData<Layer>);
|
||||||
|
|
@ -103,9 +99,6 @@ where
|
||||||
Layer::SpecificDef: Debug + Inspect,
|
Layer::SpecificDef: Debug + Inspect,
|
||||||
{
|
{
|
||||||
/// Whether the tile emits light, and the light source offset
|
/// Whether the tile emits light, and the light source offset
|
||||||
pub light: Option<ScreenVec>,
|
|
||||||
pub graphic_name: String,
|
|
||||||
pub tex_rect: IntRect,
|
|
||||||
pub layer: Layer::SpecificDef,
|
pub layer: Layer::SpecificDef,
|
||||||
//ADD pub blend_graphic: String,
|
//ADD pub blend_graphic: String,
|
||||||
}
|
}
|
||||||
|
|
@ -212,12 +205,3 @@ where
|
||||||
{
|
{
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_rect_def<Layer: TileLayer>(
|
|
||||||
def: &mut TileDef<Layer>,
|
|
||||||
rects: &std::collections::HashMap<String, IntRect>,
|
|
||||||
) where
|
|
||||||
Layer::SpecificDef: Debug + Inspect,
|
|
||||||
{
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
|
use crate::{
|
||||||
|
tiles::{BgTileId, FgTileId, MidTileId, TileId},
|
||||||
|
world::{ChunkPos, Tile as Tl, CHUNK_EXTENT},
|
||||||
|
};
|
||||||
use worldgen::{
|
use worldgen::{
|
||||||
constraint, noise::perlin::PerlinNoise,
|
constraint,
|
||||||
|
noise::perlin::PerlinNoise,
|
||||||
noisemap::{NoiseMap, NoiseMapGenerator, Seed, Step},
|
noisemap::{NoiseMap, NoiseMapGenerator, Seed, Step},
|
||||||
world::{
|
world::{
|
||||||
tile::{Constraint, ConstraintType},
|
tile::{Constraint, ConstraintType},
|
||||||
Size, Tile, World,
|
Size, Tile, World,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use crate::{
|
|
||||||
tiles::{BgTileId, FgTileId, MidTileId, TileId},
|
|
||||||
world::{ChunkPos, Tile as Tl, CHUNK_EXTENT},
|
|
||||||
};
|
|
||||||
pub(crate) struct Worldgen {}
|
pub(crate) struct Worldgen {}
|
||||||
|
|
|
||||||
18
tiles.rs
18
tiles.rs
|
|
@ -5,11 +5,7 @@ use std::{fmt::Debug, marker::PhantomData, ops::Index};
|
||||||
use egui_inspect::{derive::Inspect, Inspect};
|
use egui_inspect::{derive::Inspect, Inspect};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{math::TILE_SIZE, texture_atlas::RectMap};
|
||||||
graphics::ScreenVec,
|
|
||||||
math::{IntRect, TILE_SIZE},
|
|
||||||
texture_atlas::RectMap,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Inspect, PartialEq, Eq)]
|
#[derive(Inspect, PartialEq, Eq)]
|
||||||
pub struct TileId<Layer>(pub u16, PhantomData<Layer>);
|
pub struct TileId<Layer>(pub u16, PhantomData<Layer>);
|
||||||
|
|
@ -103,9 +99,6 @@ where
|
||||||
Layer::SpecificDef: Debug + Inspect,
|
Layer::SpecificDef: Debug + Inspect,
|
||||||
{
|
{
|
||||||
/// Whether the tile emits light, and the light source offset
|
/// Whether the tile emits light, and the light source offset
|
||||||
pub light: Option<ScreenVec>,
|
|
||||||
pub graphic_name: String,
|
|
||||||
pub tex_rect: IntRect,
|
|
||||||
pub layer: Layer::SpecificDef,
|
pub layer: Layer::SpecificDef,
|
||||||
//ADD pub blend_graphic: String,
|
//ADD pub blend_graphic: String,
|
||||||
}
|
}
|
||||||
|
|
@ -212,12 +205,3 @@ where
|
||||||
{
|
{
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_rect_def<Layer: TileLayer>(
|
|
||||||
def: &mut TileDef<Layer>,
|
|
||||||
rects: &std::collections::HashMap<String, IntRect>,
|
|
||||||
) where
|
|
||||||
Layer::SpecificDef: Debug + Inspect,
|
|
||||||
{
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue