clean
This commit is contained in:
parent
f54ca4ed19
commit
53f521fc62
@ -1,6 +1,6 @@
|
|||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use wgpu::{include_wgsl, util::DeviceExt, BindGroup, Buffer, Device, Queue, RenderPipeline, Surface, SurfaceConfiguration, VertexBufferLayout};
|
use wgpu::{include_wgsl, util::DeviceExt, BindGroup, Buffer, Device, Queue, RenderPipeline, Surface, SurfaceConfiguration, VertexBufferLayout};
|
||||||
use winit::{event::{Event, WindowEvent}, event_loop::EventLoop, window::Window};
|
use winit::{event::{Event, WindowEvent}, window::Window};
|
||||||
|
|
||||||
use crate::{state::State, App};
|
use crate::{state::State, App};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use std::{collections::{BTreeMap, HashMap}, time::Instant};
|
use std::{collections::{BTreeMap, HashMap}, time::Instant};
|
||||||
use log::info;
|
use log::trace;
|
||||||
use map::{CellKind, Map};
|
use map::{CellKind, Map};
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use voronoice::Point;
|
use voronoice::Point;
|
||||||
@ -127,7 +127,7 @@ impl State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn render(&mut self) {
|
pub fn render(&mut self) {
|
||||||
info!("render");
|
trace!("render");
|
||||||
self.vertices = Vec::new();
|
self.vertices = Vec::new();
|
||||||
self.indices = Vec::new();
|
self.indices = Vec::new();
|
||||||
|
|
||||||
@ -179,8 +179,7 @@ impl State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn update(&mut self) {
|
pub fn update(&mut self) {
|
||||||
dbg!(self.framerate);
|
trace!("update");
|
||||||
info!("update");
|
|
||||||
|
|
||||||
self.last_frame = Instant::now();
|
self.last_frame = Instant::now();
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
@ -216,7 +215,7 @@ impl State {
|
|||||||
// if Option is None remove the entity
|
// if Option is None remove the entity
|
||||||
let mut entities_to_move: Vec<(usize, Option<usize>)> = Vec::new();
|
let mut entities_to_move: Vec<(usize, Option<usize>)> = Vec::new();
|
||||||
for (eid, e) in self.entities.iter_mut() {
|
for (eid, e) in self.entities.iter_mut() {
|
||||||
match dbg!(e.update(&mut self.map, self.t, &mut rng)) {
|
match e.update(&mut self.map, self.t, &mut rng) {
|
||||||
Some(ExternOp::Move(cid)) => {
|
Some(ExternOp::Move(cid)) => {
|
||||||
entities_to_move.push((*eid, Some(cid)));
|
entities_to_move.push((*eid, Some(cid)));
|
||||||
},
|
},
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use rand::{rngs::ThreadRng, seq::IteratorRandom, Rng};
|
use rand::{rngs::ThreadRng, seq::IteratorRandom, Rng};
|
||||||
use voronoice::Point;
|
|
||||||
|
|
||||||
use crate::graphics::Vertex;
|
use crate::graphics::Vertex;
|
||||||
|
|
||||||
use super::{map::{CellData, CellKind}, Map};
|
use super::{map::CellKind, Map};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum EntityKind {
|
pub enum EntityKind {
|
||||||
@ -182,7 +181,7 @@ impl Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if dbg!(self.health) == 0. {
|
if self.health == 0. {
|
||||||
return Some(ExternOp::Remove);
|
return Some(ExternOp::Remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use noise::{Fbm, MultiFractal, NoiseFn, Perlin};
|
use noise::{Fbm, MultiFractal, NoiseFn, Perlin};
|
||||||
use rand::{Rng, SeedableRng};
|
use rand::{Rng, SeedableRng};
|
||||||
use voronoice::{BoundingBox, Point, Voronoi, VoronoiBuilder};
|
use voronoice::{BoundingBox, Point, Voronoi, VoronoiBuilder};
|
||||||
|
|
||||||
use super::entity::Entity;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum CellKind {
|
pub enum CellKind {
|
||||||
Void,
|
Void,
|
||||||
|
Loading…
Reference in New Issue
Block a user