mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-17 04:45:02 +01:00
manual
This commit is contained in:
parent
af3d9add2a
commit
31ab20d9f3
15 changed files with 41 additions and 109 deletions
|
|
@ -1,9 +1,11 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
command::CmdVec, debug::{self, DebugState},
|
command::CmdVec,
|
||||||
game::GameState, input::Input, res::Res, CliArgs,
|
debug::{self, DebugState},
|
||||||
|
game::GameState,
|
||||||
|
res::Res,
|
||||||
|
CliArgs,
|
||||||
};
|
};
|
||||||
use egui_sfml::SfEgui;
|
use egui_sfml::SfEgui;
|
||||||
use sfml::graphics::{RenderTexture, RenderWindow};
|
|
||||||
/// Application level state (includes game and ui state, etc.)
|
/// Application level state (includes game and ui state, etc.)
|
||||||
pub(crate) struct App {
|
pub(crate) struct App {
|
||||||
pub(crate) game: GameState,
|
pub(crate) game: GameState,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use crate::math::WorldPos;
|
|
||||||
/// A command that can change application or game state
|
/// A command that can change application or game state
|
||||||
pub(crate) enum Cmd {
|
pub(crate) enum Cmd {
|
||||||
/// Quit the application
|
/// Quit the application
|
||||||
|
|
|
||||||
55
src/debug.rs
55
src/debug.rs
|
|
@ -1,9 +1,5 @@
|
||||||
use crate::{
|
use crate::{command::CmdVec, game::GameState, res::Res};
|
||||||
command::CmdVec, game::GameState, res::Res, texture_atlas::AtlasBundle,
|
|
||||||
tiles::tiledb_edit_ui::TileDbEdit,
|
|
||||||
};
|
|
||||||
use egui_inspect::{derive::Inspect, inspect};
|
use egui_inspect::{derive::Inspect, inspect};
|
||||||
use sfml::audio::SoundSource;
|
|
||||||
#[derive(Default, Debug, Inspect)]
|
#[derive(Default, Debug, Inspect)]
|
||||||
pub(crate) struct DebugState {}
|
pub(crate) struct DebugState {}
|
||||||
fn debug_panel_ui(
|
fn debug_panel_ui(
|
||||||
|
|
@ -13,36 +9,25 @@ fn debug_panel_ui(
|
||||||
res: &mut Res,
|
res: &mut Res,
|
||||||
mut scale: &mut u8,
|
mut scale: &mut u8,
|
||||||
) {
|
) {
|
||||||
egui::Window::new("Debug (F12)")
|
egui::Window::new("Debug (F12)").show(ctx, |ui| {
|
||||||
.show(
|
egui::ScrollArea::both()
|
||||||
ctx,
|
.id_source("insp_scroll")
|
||||||
|ui| {
|
.max_height(240.)
|
||||||
egui::ScrollArea::both()
|
.max_width(340.0)
|
||||||
.id_source("insp_scroll")
|
.show(ui, |ui| {
|
||||||
.max_height(240.)
|
inspect! {
|
||||||
.max_width(340.0)
|
ui, scale, game, debug
|
||||||
.show(
|
}
|
||||||
ui,
|
});
|
||||||
|ui| {
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
inspect! {
|
gamedebug_core::for_each_imm(|info| match info {
|
||||||
ui, scale, game, debug
|
gamedebug_core::Info::Msg(msg) => {
|
||||||
}
|
ui.label(msg);
|
||||||
},
|
}
|
||||||
);
|
gamedebug_core::Info::Rect(_, _, _, _, _) => todo!(),
|
||||||
egui::ScrollArea::vertical()
|
});
|
||||||
.show(
|
});
|
||||||
ui,
|
});
|
||||||
|ui| {
|
|
||||||
gamedebug_core::for_each_imm(|info| match info {
|
|
||||||
gamedebug_core::Info::Msg(msg) => {
|
|
||||||
ui.label(msg);
|
|
||||||
}
|
|
||||||
gamedebug_core::Info::Rect(_, _, _, _, _) => todo!(),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
pub(crate) fn do_debug_ui(
|
pub(crate) fn do_debug_ui(
|
||||||
ctx: &egui::Context,
|
ctx: &egui::Context,
|
||||||
|
|
|
||||||
18
src/game.rs
18
src/game.rs
|
|
@ -1,21 +1,7 @@
|
||||||
use std::path::PathBuf;
|
use crate::{math::WorldPos, tiles::TileDb};
|
||||||
use derivative::Derivative;
|
use derivative::Derivative;
|
||||||
use egui_inspect::derive::Inspect;
|
use egui_inspect::derive::Inspect;
|
||||||
use sfml::{
|
|
||||||
graphics::{
|
|
||||||
Color, Rect, RectangleShape, RenderTarget, RenderTexture, Shape, Sprite,
|
|
||||||
Transformable,
|
|
||||||
},
|
|
||||||
system::{Vector2f, Vector2u},
|
|
||||||
window::Key,
|
|
||||||
};
|
|
||||||
use crate::{
|
|
||||||
graphics::{ScreenSc, ScreenVec},
|
|
||||||
input::Input, inventory::{Inventory, ItemDb},
|
|
||||||
math::{smoothwave, wp_to_tp, WorldPos},
|
|
||||||
res::Res, tiles::TileDb, world::{TilePos, World},
|
|
||||||
worldgen::Worldgen,
|
|
||||||
};
|
|
||||||
#[derive(Derivative, Inspect)]
|
#[derive(Derivative, Inspect)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub(crate) struct GameState {
|
pub(crate) struct GameState {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
use egui_inspect::derive::Inspect;
|
use egui_inspect::derive::Inspect;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sfml::{
|
|
||||||
graphics::RenderWindow, system::Vector2f, window::{ContextSettings, Style, VideoMode},
|
|
||||||
};
|
|
||||||
use sfml_xt::graphics::RenderWindowExt;
|
|
||||||
use crate::math::FPS_TARGET;
|
|
||||||
#[derive(Default, Clone, Copy, Debug, Inspect, Serialize, Deserialize)]
|
#[derive(Default, Clone, Copy, Debug, Inspect, Serialize, Deserialize)]
|
||||||
pub(crate) struct ScreenVec {}
|
pub(crate) struct ScreenVec {}
|
||||||
/// Screen position/offset scalar
|
/// Screen position/offset scalar
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,2 @@
|
||||||
use fnv::FnvHashSet;
|
|
||||||
use sfml::window::{mouse, Event, Key};
|
|
||||||
use crate::graphics::ScreenVec;
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
pub(crate) struct Input {}
|
pub(crate) struct Input {}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use egui_inspect::derive::Inspect;
|
use egui_inspect::derive::Inspect;
|
||||||
use crate::{math::IntRect, tiles::{BgTileId, FgTileId, MidTileId}};
|
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
pub(crate) struct Inventory {}
|
pub(crate) struct Inventory {}
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
use std::fmt::Debug;
|
use crate::world::TPosSc;
|
||||||
use egui_inspect::derive::Inspect;
|
use egui_inspect::derive::Inspect;
|
||||||
use num_traits::{Num, Signed};
|
use num_traits::Num;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use crate::world::{TPosSc, TilePos};
|
use std::fmt::Debug;
|
||||||
pub(crate) type WPosSc = u32;
|
pub(crate) type WPosSc = u32;
|
||||||
#[derive(Clone, Copy, Debug, Inspect)]
|
#[derive(Clone, Copy, Debug, Inspect)]
|
||||||
pub(crate) struct WorldPos {}
|
pub(crate) struct WorldPos {}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,5 @@
|
||||||
use std::path::Path;
|
use egui_inspect::derive::Inspect;
|
||||||
use egui_inspect::{derive::Inspect, inspect};
|
|
||||||
use s2dc::{vec2, MobileEntity};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use crate::{
|
|
||||||
math::{WorldPos, TILE_SIZE},
|
|
||||||
world::{TPosSc, TilePos},
|
|
||||||
};
|
|
||||||
#[derive(Debug, Inspect, Serialize, Deserialize)]
|
#[derive(Debug, Inspect, Serialize, Deserialize)]
|
||||||
pub(crate) struct Player {}
|
pub(crate) struct Player {}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use sfml::audio::Music;
|
|
||||||
use crate::texture_atlas::AtlasBundle;
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct Res {}
|
pub(crate) struct Res {}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use std::{collections::HashMap, path::Path};
|
|
||||||
use crate::math::IntRect;
|
use crate::math::IntRect;
|
||||||
use sfml::{graphics::Texture, SfBox};
|
use std::collections::HashMap;
|
||||||
use texture_packer::{texture::Texture as _, TexturePacker, TexturePackerConfig};
|
|
||||||
pub(crate) type RectMap = HashMap<String, IntRect>;
|
pub(crate) type RectMap = HashMap<String, IntRect>;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct AtlasBundle {}
|
pub(crate) struct AtlasBundle {}
|
||||||
|
|
|
||||||
10
src/world.rs
10
src/world.rs
|
|
@ -1,14 +1,8 @@
|
||||||
mod reg_chunk_existence;
|
mod reg_chunk_existence;
|
||||||
mod serialization;
|
mod serialization;
|
||||||
use std::{fmt::Debug, fs::File, io::Seek, path::{Path, PathBuf}};
|
|
||||||
use egui_inspect::derive::Inspect;
|
use egui_inspect::derive::Inspect;
|
||||||
use fnv::FnvHashMap;
|
use std::fmt::Debug;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use crate::{
|
|
||||||
math::WorldPos, player::Player, tiles::{BgTileId, FgTileId, MidTileId, TileId},
|
|
||||||
world::reg_chunk_existence::ExistenceBitset, worldgen::Worldgen,
|
|
||||||
};
|
|
||||||
use self::serialization::save_chunk;
|
|
||||||
#[derive(Hash, PartialEq, Eq, Debug, Clone, Copy, Inspect)]
|
#[derive(Hash, PartialEq, Eq, Debug, Clone, Copy, Inspect)]
|
||||||
pub(crate) struct ChunkPos {}
|
pub(crate) struct ChunkPos {}
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
use std::{fs::File, io::Read, path::Path};
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub(crate) struct ExistenceBitset();
|
pub(crate) struct ExistenceBitset();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,6 @@
|
||||||
use std::{
|
|
||||||
fs::OpenOptions, io::{Seek, Write},
|
|
||||||
path::Path,
|
|
||||||
};
|
|
||||||
use crate::world::{
|
|
||||||
format_reg_file_name, loc_byte_idx, loc_idx, reg_chunk_existence::ExistenceBitset,
|
|
||||||
REGION_BYTES, TILE_BYTES,
|
|
||||||
};
|
|
||||||
use super::{default_chunk_tiles, loc_byte_idx_xy, Chunk, ChunkPos};
|
use super::{default_chunk_tiles, loc_byte_idx_xy, Chunk, ChunkPos};
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
pub(super) fn save_chunk(pos: &ChunkPos, chk: &Chunk, world_dir: &Path) {
|
pub(super) fn save_chunk(pos: &ChunkPos, chk: &Chunk, world_dir: &Path) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1 @@
|
||||||
use crate::{
|
|
||||||
tiles::{BgTileId, FgTileId, MidTileId, TileId},
|
|
||||||
world::{ChunkPos, Tile as Tl, CHUNK_EXTENT},
|
|
||||||
};
|
|
||||||
use worldgen::{
|
|
||||||
constraint,
|
|
||||||
noise::perlin::PerlinNoise,
|
|
||||||
noisemap::{NoiseMap, NoiseMapGenerator, Seed, Step},
|
|
||||||
world::{
|
|
||||||
tile::{Constraint, ConstraintType},
|
|
||||||
Size, Tile, World,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
pub(crate) struct Worldgen {}
|
pub(crate) struct Worldgen {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue