mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
delete
This commit is contained in:
parent
98dd54f1f2
commit
62107a20d8
21 changed files with 138 additions and 459 deletions
34
src/app.rs
34
src/app.rs
|
|
@ -22,28 +22,27 @@ use crate::{
|
||||||
res::Res, tiles::TileId, CliArgs,
|
res::Res, tiles::TileId, CliArgs,
|
||||||
};
|
};
|
||||||
/// Application level state (includes game and ui state, etc.)
|
/// Application level state (includes game and ui state, etc.)
|
||||||
pub struct App {
|
pub(crate) struct App {
|
||||||
pub rw: RenderWindow,
|
pub(crate) rw: RenderWindow,
|
||||||
pub should_quit: bool,
|
pub(crate) should_quit: bool,
|
||||||
pub game: GameState,
|
pub(crate) game: GameState,
|
||||||
pub res: Res,
|
pub(crate) res: Res,
|
||||||
pub sf_egui: SfEgui,
|
pub(crate) sf_egui: SfEgui,
|
||||||
pub input: Input,
|
pub(crate) input: Input,
|
||||||
pub debug: DebugState,
|
pub(crate) debug: DebugState,
|
||||||
/// Integer scale for rendering the game
|
/// Integer scale for rendering the game
|
||||||
pub scale: u8,
|
pub(crate) scale: u8,
|
||||||
/// RenderTexture for rendering the game at its native resolution
|
/// RenderTexture for rendering the game at its native resolution
|
||||||
pub rt: RenderTexture,
|
pub(crate) rt: RenderTexture,
|
||||||
/// Light map overlay, blended together with the non-lighted version of the scene
|
/// Light map overlay, blended together with the non-lighted version of the scene
|
||||||
pub light_map: RenderTexture,
|
pub(crate) light_map: RenderTexture,
|
||||||
pub project_dirs: ProjectDirs,
|
pub(crate) cmdvec: CmdVec,
|
||||||
pub cmdvec: CmdVec,
|
|
||||||
}
|
}
|
||||||
impl App {
|
impl App {
|
||||||
pub fn new(args: CliArgs) -> anyhow::Result<Self> {
|
pub(crate) fn new(args: CliArgs) -> anyhow::Result<Self> {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn do_game_loop(&mut self) {
|
pub(crate) fn do_game_loop(&mut self) {
|
||||||
while !self.should_quit {
|
while !self.should_quit {
|
||||||
self.do_event_handling();
|
self.do_event_handling();
|
||||||
self.do_update();
|
self.do_update();
|
||||||
|
|
@ -122,11 +121,6 @@ impl App {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Tile collision entity for doing physics
|
|
||||||
struct TileColEn {
|
|
||||||
col: s2dc::Entity,
|
|
||||||
platform: bool,
|
|
||||||
}
|
|
||||||
fn viewport_center_offset(rw_size: Vector2u, rt_size: Vector2u, scale: u8) -> ScreenVec {
|
fn viewport_center_offset(rw_size: Vector2u, rt_size: Vector2u, scale: u8) -> ScreenVec {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,2 @@
|
||||||
use std::ops::{BitAndAssign, BitOrAssign};
|
use std::ops::{BitAndAssign, BitOrAssign};
|
||||||
use num_traits::PrimInt;
|
use num_traits::PrimInt;
|
||||||
pub fn nth_bit_set<N: PrimInt>(number: N, n: usize) -> bool {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub fn set_nth_bit<N: PrimInt + BitOrAssign + BitAndAssign>(
|
|
||||||
number: &mut N,
|
|
||||||
n: usize,
|
|
||||||
set: bool,
|
|
||||||
) {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
#[allow(clippy::bool_assert_comparison)]
|
|
||||||
fn test_nth_bit_set() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
#[allow(clippy::bool_assert_comparison)]
|
|
||||||
fn test_set_nth_bit() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use crate::{command::Cmd, math::WorldPos};
|
use crate::{command::Cmd, math::WorldPos};
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
pub enum CmdLine {
|
pub(crate) enum CmdLine {
|
||||||
Quit,
|
Quit,
|
||||||
Freecam,
|
Freecam,
|
||||||
Clear,
|
Clear,
|
||||||
|
|
@ -10,31 +10,6 @@ pub enum CmdLine {
|
||||||
Give(Give),
|
Give(Give),
|
||||||
}
|
}
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
pub struct Tp {
|
pub(crate) struct Tp {}
|
||||||
x: u32,
|
|
||||||
y: u32,
|
|
||||||
/// Relative to current position
|
|
||||||
#[arg(short, long)]
|
|
||||||
rel: bool,
|
|
||||||
}
|
|
||||||
impl Tp {
|
|
||||||
fn to_world_pos(&self) -> WorldPos {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
pub struct Give {
|
pub(crate) struct Give {}
|
||||||
name: String,
|
|
||||||
}
|
|
||||||
pub enum Dispatch {
|
|
||||||
Cmd(Cmd),
|
|
||||||
ClearConsole,
|
|
||||||
}
|
|
||||||
impl CmdLine {
|
|
||||||
pub fn parse_cmdline(cmdline: &str) -> anyhow::Result<Self> {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub(crate) fn dispatch(self) -> Dispatch {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
use crate::math::WorldPos;
|
use crate::math::WorldPos;
|
||||||
|
|
||||||
/// A command that can change application or game state
|
/// A command that can change application or game state
|
||||||
pub enum Cmd {
|
pub(crate) enum Cmd {
|
||||||
/// Quit the application
|
/// Quit the application
|
||||||
QuitApp,
|
QuitApp,
|
||||||
ToggleFreecam,
|
ToggleFreecam,
|
||||||
TeleportPlayer {
|
TeleportPlayer {},
|
||||||
pos: WorldPos,
|
|
||||||
relative: bool,
|
|
||||||
},
|
|
||||||
TeleportPlayerSpawn,
|
TeleportPlayerSpawn,
|
||||||
GiveItemByName(String),
|
GiveItemByName(),
|
||||||
}
|
}
|
||||||
|
pub(crate) type CmdVec = Vec<Cmd>;
|
||||||
pub type CmdVec = Vec<Cmd>;
|
|
||||||
|
|
|
||||||
20
src/debug.rs
20
src/debug.rs
|
|
@ -9,20 +9,16 @@ use crate::{
|
||||||
tiles::tiledb_edit_ui::TileDbEdit,
|
tiles::tiledb_edit_ui::TileDbEdit,
|
||||||
};
|
};
|
||||||
#[derive(Default, Debug, Inspect)]
|
#[derive(Default, Debug, Inspect)]
|
||||||
pub struct DebugState {
|
pub(crate) struct DebugState {
|
||||||
pub panel: bool,
|
pub(crate) panel: bool,
|
||||||
pub freecam: bool,
|
pub(crate) freecam: bool,
|
||||||
pub tiledb_edit: TileDbEdit,
|
pub(crate) tiledb_edit: TileDbEdit,
|
||||||
pub show_atlas: bool,
|
pub(crate) show_atlas: bool,
|
||||||
pub console: Console,
|
pub(crate) console: Console,
|
||||||
}
|
}
|
||||||
#[derive(Default, Debug, Inspect)]
|
#[derive(Default, Debug, Inspect)]
|
||||||
pub struct Console {
|
pub(crate) struct Console {
|
||||||
pub show: bool,
|
pub(crate) show: bool,
|
||||||
pub cmdline: String,
|
|
||||||
pub log: String,
|
|
||||||
pub just_opened: bool,
|
|
||||||
pub history: Vec<String>,
|
|
||||||
}
|
}
|
||||||
fn debug_panel_ui(
|
fn debug_panel_ui(
|
||||||
mut debug: &mut DebugState,
|
mut debug: &mut DebugState,
|
||||||
|
|
|
||||||
39
src/game.rs
39
src/game.rs
|
|
@ -18,43 +18,32 @@ use crate::{
|
||||||
};
|
};
|
||||||
#[derive(Derivative, Inspect)]
|
#[derive(Derivative, Inspect)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
pub struct GameState {
|
pub(crate) struct GameState {
|
||||||
pub camera_offset: WorldPos,
|
pub(crate) camera_offset: WorldPos,
|
||||||
pub world: World,
|
pub(crate) world: World,
|
||||||
pub gravity: f32,
|
pub(crate) tile_db: TileDb,
|
||||||
pub current_biome: Biome,
|
|
||||||
pub prev_biome: Biome,
|
|
||||||
#[derivative(Debug = "ignore")]
|
|
||||||
#[opaque]
|
|
||||||
pub worldgen: Worldgen,
|
|
||||||
pub ambient_light: u8,
|
|
||||||
pub light_sources: Vec<LightSource>,
|
|
||||||
pub tile_db: TileDb,
|
|
||||||
pub inventory: Inventory,
|
|
||||||
pub itemdb: ItemDb,
|
|
||||||
pub selected_inv_slot: usize,
|
|
||||||
pub spawn_point: WorldPos,
|
|
||||||
}
|
|
||||||
#[derive(Debug, Inspect)]
|
|
||||||
pub struct LightSource {
|
|
||||||
pub pos: ScreenVec,
|
|
||||||
}
|
}
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug, Inspect)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug, Inspect)]
|
||||||
pub enum Biome {
|
pub(crate) enum Biome {
|
||||||
Surface,
|
Surface,
|
||||||
Underground,
|
Underground,
|
||||||
}
|
}
|
||||||
impl GameState {
|
impl GameState {
|
||||||
pub fn update(&mut self, input: &Input) {
|
pub(crate) fn update(&mut self, input: &Input) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub(crate) fn draw_world(&mut self, rt: &mut RenderTexture, res: &mut Res) {
|
pub(crate) fn draw_world(&mut self, rt: &mut RenderTexture, res: &mut Res) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn draw_entities(&mut self, rt: &mut RenderTexture) {
|
pub(crate) fn draw_entities(&mut self, rt: &mut RenderTexture) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn draw_ui(&mut self, rt: &mut RenderTexture, res: &Res, ui_dims: Vector2f) {
|
pub(crate) fn draw_ui(
|
||||||
|
&mut self,
|
||||||
|
rt: &mut RenderTexture,
|
||||||
|
res: &Res,
|
||||||
|
ui_dims: Vector2f,
|
||||||
|
) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub(crate) fn light_pass(&mut self, lightmap: &mut RenderTexture, res: &Res) {
|
pub(crate) fn light_pass(&mut self, lightmap: &mut RenderTexture, res: &Res) {
|
||||||
|
|
@ -64,7 +53,7 @@ impl GameState {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn for_each_tile_on_screen(
|
pub(crate) fn for_each_tile_on_screen(
|
||||||
camera_offset: WorldPos,
|
camera_offset: WorldPos,
|
||||||
rt_size: Vector2u,
|
rt_size: Vector2u,
|
||||||
mut f: impl FnMut(TilePos, ScreenVec),
|
mut f: impl FnMut(TilePos, ScreenVec),
|
||||||
|
|
|
||||||
|
|
@ -5,29 +5,15 @@ use sfml::{
|
||||||
};
|
};
|
||||||
use sfml_xt::graphics::RenderWindowExt;
|
use sfml_xt::graphics::RenderWindowExt;
|
||||||
use crate::math::FPS_TARGET;
|
use crate::math::FPS_TARGET;
|
||||||
pub struct ScreenRes {
|
pub(crate) struct ScreenRes {
|
||||||
pub w: u16,
|
pub(crate) w: u16,
|
||||||
pub h: u16,
|
pub(crate) h: u16,
|
||||||
}
|
|
||||||
impl ScreenRes {
|
|
||||||
fn to_sf(&self) -> VideoMode {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#[derive(Default, Clone, Copy, Debug, Inspect, Serialize, Deserialize)]
|
#[derive(Default, Clone, Copy, Debug, Inspect, Serialize, Deserialize)]
|
||||||
pub struct ScreenVec {
|
pub struct ScreenVec {
|
||||||
pub x: ScreenSc,
|
pub(crate) x: ScreenSc,
|
||||||
pub y: ScreenSc,
|
pub(crate) y: ScreenSc,
|
||||||
}
|
}
|
||||||
/// Screen position/offset scalar
|
/// Screen position/offset scalar
|
||||||
/// We assume this game won't be played above 32767*32767 resolution
|
/// We assume this game won't be played above 32767*32767 resolution
|
||||||
pub type ScreenSc = i16;
|
pub(crate) type ScreenSc = i16;
|
||||||
impl ScreenVec {
|
|
||||||
pub fn to_sf_vec(self) -> Vector2f {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const DEFAULT_RES: ScreenRes = ScreenRes { w: 960, h: 540 };
|
|
||||||
pub fn make_window() -> RenderWindow {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
22
src/input.rs
22
src/input.rs
|
|
@ -2,26 +2,24 @@ use fnv::FnvHashSet;
|
||||||
use sfml::window::{mouse, Event, Key};
|
use sfml::window::{mouse, Event, Key};
|
||||||
use crate::graphics::ScreenVec;
|
use crate::graphics::ScreenVec;
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
pub struct Input {
|
pub(crate) struct Input {}
|
||||||
down: FnvHashSet<Key>,
|
|
||||||
pressed: FnvHashSet<Key>,
|
|
||||||
pub lmb_down: bool,
|
|
||||||
pub rmb_down: bool,
|
|
||||||
pub mouse_down_loc: ScreenVec,
|
|
||||||
pub mid_pressed: bool,
|
|
||||||
}
|
|
||||||
impl Input {
|
impl Input {
|
||||||
pub fn update_from_event(&mut self, ev: &Event, egui_kbd: bool, egui_ptr: bool) {
|
pub(crate) fn update_from_event(
|
||||||
|
&mut self,
|
||||||
|
ev: &Event,
|
||||||
|
egui_kbd: bool,
|
||||||
|
egui_ptr: bool,
|
||||||
|
) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
/// Pressed event should be cleared every frame
|
/// Pressed event should be cleared every frame
|
||||||
pub fn clear_pressed(&mut self) {
|
pub(crate) fn clear_pressed(&mut self) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn down(&self, key: Key) -> bool {
|
pub(crate) fn down(&self, key: Key) -> bool {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn pressed(&self, key: Key) -> bool {
|
pub(crate) fn pressed(&self, key: Key) -> bool {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,62 +1,24 @@
|
||||||
use egui_inspect::derive::Inspect;
|
use egui_inspect::derive::Inspect;
|
||||||
use crate::{math::IntRect, tiles::{BgTileId, FgTileId, MidTileId}};
|
use crate::{math::IntRect, tiles::{BgTileId, FgTileId, MidTileId}};
|
||||||
/// We won't have more than 65535 different items
|
/// We won't have more than 65535 different items
|
||||||
pub type ItemId = u16;
|
pub(crate) type ItemId = u16;
|
||||||
/// We won't have more than 65535 item quantity in a single slot
|
|
||||||
pub type ItemQty = u16;
|
|
||||||
/// Inventory slot
|
/// Inventory slot
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
pub struct Slot {
|
pub(crate) struct Slot {}
|
||||||
pub id: ItemId,
|
|
||||||
pub qty: ItemQty,
|
|
||||||
}
|
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
pub struct Inventory {
|
pub(crate) struct Inventory {}
|
||||||
pub slots: Vec<Slot>,
|
|
||||||
}
|
|
||||||
impl Inventory {
|
|
||||||
/// A new inventory filled with some debug items
|
|
||||||
pub(crate) fn new_debug() -> Inventory {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Debug, Inspect)]
|
|
||||||
pub struct ItemDef {
|
|
||||||
pub name: String,
|
|
||||||
pub graphic_name: String,
|
|
||||||
pub tex_rect: IntRect,
|
|
||||||
#[opaque]
|
|
||||||
pub use_action: UseAction,
|
|
||||||
pub consumable: bool,
|
|
||||||
}
|
|
||||||
#[derive(Debug, Inspect, PartialEq)]
|
#[derive(Debug, Inspect, PartialEq)]
|
||||||
pub enum TileLayer {
|
pub(crate) enum TileLayer {
|
||||||
Bg,
|
Bg,
|
||||||
Mid,
|
Mid,
|
||||||
Fg,
|
Fg,
|
||||||
}
|
}
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum UseAction {
|
pub(crate) enum UseAction {
|
||||||
PlaceBgTile { id: BgTileId },
|
PlaceBgTile {},
|
||||||
PlaceMidTile { id: MidTileId },
|
PlaceMidTile {},
|
||||||
PlaceFgTile { id: FgTileId },
|
PlaceFgTile {},
|
||||||
RemoveTile { layer: TileLayer },
|
RemoveTile {},
|
||||||
}
|
}
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
pub struct ItemDb {
|
pub(crate) struct ItemDb {}
|
||||||
pub db: Vec<ItemDef>,
|
|
||||||
}
|
|
||||||
impl Default for ItemDb {
|
|
||||||
fn default() -> Self {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub mod items {
|
|
||||||
use super::ItemId;
|
|
||||||
pub const DIRT_BLOCK: ItemId = 0;
|
|
||||||
pub const TORCH: ItemId = 1;
|
|
||||||
pub const PLATFORM: ItemId = 2;
|
|
||||||
pub const WOOD_PICK: ItemId = 3;
|
|
||||||
pub const PANZERIUM: ItemId = 4;
|
|
||||||
pub const STONE_WALL: ItemId = 5;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
14
src/main.rs
14
src/main.rs
|
|
@ -1,5 +1,4 @@
|
||||||
mod app;
|
mod app;
|
||||||
mod bitmanip;
|
|
||||||
mod cmdline;
|
mod cmdline;
|
||||||
mod command;
|
mod command;
|
||||||
mod debug;
|
mod debug;
|
||||||
|
|
@ -15,16 +14,10 @@ mod texture_atlas;
|
||||||
mod tiles;
|
mod tiles;
|
||||||
mod world;
|
mod world;
|
||||||
mod worldgen;
|
mod worldgen;
|
||||||
|
|
||||||
use app::App;
|
use app::App;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
pub struct CliArgs {
|
pub(crate) struct CliArgs {}
|
||||||
#[arg(default_value = "TestWorld")]
|
|
||||||
world_name: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn try_main() -> anyhow::Result<()> {
|
fn try_main() -> anyhow::Result<()> {
|
||||||
gamedebug_core::set_enabled(true);
|
gamedebug_core::set_enabled(true);
|
||||||
let cli_args = CliArgs::parse();
|
let cli_args = CliArgs::parse();
|
||||||
|
|
@ -32,11 +25,8 @@ fn try_main() -> anyhow::Result<()> {
|
||||||
app.do_game_loop();
|
app.do_game_loop();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
env_logger::builder()
|
env_logger::builder().filter_level(log::LevelFilter::Info).init();
|
||||||
.filter_level(log::LevelFilter::Info)
|
|
||||||
.init();
|
|
||||||
if let Err(e) = try_main() {
|
if let Err(e) = try_main() {
|
||||||
rfd::MessageDialog::new()
|
rfd::MessageDialog::new()
|
||||||
.set_title("Fatal error")
|
.set_title("Fatal error")
|
||||||
|
|
|
||||||
58
src/math.rs
58
src/math.rs
|
|
@ -3,37 +3,34 @@ use egui_inspect::derive::Inspect;
|
||||||
use num_traits::{Num, Signed};
|
use num_traits::{Num, Signed};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use crate::world::{TPosSc, TilePos};
|
use crate::world::{TPosSc, TilePos};
|
||||||
pub type WPosSc = u32;
|
pub(crate) type WPosSc = u32;
|
||||||
#[derive(Clone, Copy, Debug, Inspect)]
|
#[derive(Clone, Copy, Debug, Inspect)]
|
||||||
pub struct WorldPos {
|
pub(crate) struct WorldPos {
|
||||||
pub x: WPosSc,
|
pub(crate) x: WPosSc,
|
||||||
pub y: WPosSc,
|
pub(crate) y: WPosSc,
|
||||||
}
|
}
|
||||||
/// Tile size in pixels
|
/// Tile size in pixels
|
||||||
pub const TILE_SIZE: u8 = 32;
|
pub(crate) const TILE_SIZE: u8 = 32;
|
||||||
/// Pixels per meter.
|
/// Pixels per meter.
|
||||||
pub const PX_PER_M: f32 = TILE_SIZE as f32 * 2.;
|
pub(crate) const PX_PER_M: f32 = TILE_SIZE as f32 * 2.;
|
||||||
/// Meters per pixel
|
/// Meters per pixel
|
||||||
pub const M_PER_PX: f32 = 1. / PX_PER_M;
|
pub(crate) const M_PER_PX: f32 = 1. / PX_PER_M;
|
||||||
pub const FPS_TARGET: u8 = 60;
|
pub(crate) const FPS_TARGET: u8 = 60;
|
||||||
pub fn px_per_frame_to_m_per_s(px_per_frame: f32) -> f32 {
|
pub(crate) fn px_per_frame_to_km_h(px_per_frame: f32) -> f32 {
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub fn px_per_frame_to_km_h(px_per_frame: f32) -> f32 {
|
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
/// World extent in tiles. Roughly 50km*50km.
|
/// World extent in tiles. Roughly 50km*50km.
|
||||||
pub const WORLD_EXTENT: TPosSc = 100_000;
|
pub(crate) const WORLD_EXTENT: TPosSc = 100_000;
|
||||||
impl WorldPos {
|
impl WorldPos {
|
||||||
pub fn tile_pos(&self) -> TilePos {
|
pub(crate) fn tile_pos(&self) -> TilePos {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
/// Horizontal center of the world
|
/// Horizontal center of the world
|
||||||
pub const CENTER: WPosSc = (WORLD_EXTENT / 2) * TILE_SIZE as WPosSc;
|
pub(crate) const CENTER: WPosSc = (WORLD_EXTENT / 2) * TILE_SIZE as WPosSc;
|
||||||
/// Vertical surface level.
|
/// Vertical surface level.
|
||||||
/// You can build 10 km high.
|
/// You can build 10 km high.
|
||||||
pub const SURFACE: WPosSc = 20_000 * TILE_SIZE as WPosSc;
|
pub(crate) const SURFACE: WPosSc = 20_000 * TILE_SIZE as WPosSc;
|
||||||
pub const SURFACE_CENTER: Self = Self {
|
pub(crate) const SURFACE_CENTER: Self = Self {
|
||||||
x: Self::CENTER,
|
x: Self::CENTER,
|
||||||
y: Self::SURFACE,
|
y: Self::SURFACE,
|
||||||
};
|
};
|
||||||
|
|
@ -41,33 +38,20 @@ impl WorldPos {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn wp_to_tp(wp: WPosSc) -> TPosSc {
|
pub(crate) fn wp_to_tp(wp: WPosSc) -> TPosSc {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn center_offset<N: From<u8> + Copy + Signed>(xw: N, yw: N) -> N {
|
pub(crate) fn center_offset<N: From<u8> + Copy + Signed>(xw: N, yw: N) -> N {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
/// A smooth triangle-wave like transform of the input value, oscillating between 0 and the ceiling.
|
/// A smooth triangle-wave like transform of the input value, oscillating between 0 and the ceiling.
|
||||||
pub fn smoothwave<T: Num + From<u8> + PartialOrd + Copy>(input: T, max: T) -> T {
|
pub(crate) fn smoothwave<T: Num + From<u8> + PartialOrd + Copy>(input: T, max: T) -> T {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
#[derive(Serialize, Deserialize, Debug, Inspect, Default, Clone, Copy)]
|
#[derive(Serialize, Deserialize, Debug, Inspect, Default, Clone, Copy)]
|
||||||
pub struct IntRect {
|
pub struct IntRect {
|
||||||
pub x: i32,
|
pub(crate) x: i32,
|
||||||
pub y: i32,
|
pub(crate) y: i32,
|
||||||
pub w: i32,
|
pub(crate) w: i32,
|
||||||
pub h: i32,
|
pub(crate) h: i32,
|
||||||
}
|
|
||||||
impl IntRect {
|
|
||||||
pub(crate) fn to_sf(self) -> sfml::graphics::Rect<i32> {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn test_smooth_wave() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn test_wp_to_tp() {
|
|
||||||
loop {}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,30 +7,27 @@ use crate::{
|
||||||
world::{TPosSc, TilePos},
|
world::{TPosSc, TilePos},
|
||||||
};
|
};
|
||||||
#[derive(Debug, Inspect, Serialize, Deserialize)]
|
#[derive(Debug, Inspect, Serialize, Deserialize)]
|
||||||
pub struct Player {
|
pub(crate) struct Player {
|
||||||
#[inspect_with(inspect_mobile_entity)]
|
#[inspect_with(inspect_mobile_entity)]
|
||||||
pub col_en: MobileEntity,
|
pub(crate) col_en: MobileEntity,
|
||||||
pub vspeed: f32,
|
pub(crate) vspeed: f32,
|
||||||
pub hspeed: f32,
|
pub(crate) hspeed: f32,
|
||||||
pub jumps_left: u8,
|
|
||||||
/// true if the player wants to jump down from a platform
|
|
||||||
pub down_intent: bool,
|
|
||||||
}
|
}
|
||||||
fn inspect_mobile_entity(en: &mut MobileEntity, ui: &mut egui::Ui, _id_src: u64) {
|
fn inspect_mobile_entity(en: &mut MobileEntity, ui: &mut egui::Ui, _id_src: u64) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
impl Player {
|
impl Player {
|
||||||
pub fn new_at(pos: WorldPos) -> Self {
|
pub(crate) fn new_at(pos: WorldPos) -> Self {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn center_tp(&self) -> TilePos {
|
pub(crate) fn center_tp(&self) -> TilePos {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn can_jump(&self) -> bool {
|
pub(crate) fn can_jump(&self) -> bool {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn feet_y(&self) -> i32 {
|
pub(crate) fn feet_y(&self) -> i32 {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub(crate) fn save(&self, path: &Path) {
|
pub(crate) fn save(&self, path: &Path) {
|
||||||
|
|
|
||||||
12
src/res.rs
12
src/res.rs
|
|
@ -1,13 +1,7 @@
|
||||||
use sfml::audio::Music;
|
use sfml::audio::Music;
|
||||||
use crate::texture_atlas::AtlasBundle;
|
use crate::texture_atlas::AtlasBundle;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Res {
|
pub(crate) struct Res {
|
||||||
pub atlas: AtlasBundle,
|
pub(crate) atlas: AtlasBundle,
|
||||||
pub surf_music: Music<'static>,
|
pub(crate) surf_music: Music<'static>,
|
||||||
pub und_music: Music<'static>,
|
|
||||||
}
|
|
||||||
impl Res {
|
|
||||||
pub fn load() -> anyhow::Result<Self> {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use crate::math::M_PER_PX;
|
use crate::math::M_PER_PX;
|
||||||
pub struct LengthDisp(pub f32);
|
pub(crate) struct LengthDisp(pub f32);
|
||||||
impl fmt::Display for LengthDisp {
|
impl fmt::Display for LengthDisp {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
loop {}
|
loop {}
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,14 @@ use std::{collections::HashMap, path::Path};
|
||||||
use crate::math::IntRect;
|
use crate::math::IntRect;
|
||||||
use sfml::{graphics::Texture, SfBox};
|
use sfml::{graphics::Texture, SfBox};
|
||||||
use texture_packer::{texture::Texture as _, TexturePacker, TexturePackerConfig};
|
use texture_packer::{texture::Texture as _, TexturePacker, TexturePackerConfig};
|
||||||
pub type RectMap = HashMap<String, IntRect>;
|
pub(crate) type RectMap = HashMap<String, IntRect>;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AtlasBundle {
|
pub(crate) struct AtlasBundle {
|
||||||
pub tex: SfBox<Texture>,
|
pub(crate) tex: SfBox<Texture>,
|
||||||
pub rects: RectMap,
|
pub(crate) rects: RectMap,
|
||||||
}
|
}
|
||||||
impl AtlasBundle {
|
impl AtlasBundle {
|
||||||
pub fn new() -> anyhow::Result<Self> {
|
pub(crate) fn new() -> anyhow::Result<Self> {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn make_pix_buf(packer: &TexturePacker<image::DynamicImage, String>) -> Vec<u8> {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
fn path_img_key(path: &Path) -> String {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn test_path_img_key() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
fn walk_graphics(mut f: impl FnMut(&Path)) {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ impl Bg {
|
||||||
h: 0,
|
h: 0,
|
||||||
},
|
},
|
||||||
layer: (),
|
layer: (),
|
||||||
|
blend_graphic: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -76,6 +77,7 @@ impl Mid {
|
||||||
h: 32,
|
h: 32,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
blend_graphic: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +94,7 @@ impl Fg {
|
||||||
h: 0,
|
h: 0,
|
||||||
},
|
},
|
||||||
layer: (),
|
layer: (),
|
||||||
|
blend_graphic: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -145,6 +148,7 @@ where
|
||||||
pub graphic_name: String,
|
pub graphic_name: String,
|
||||||
pub tex_rect: IntRect,
|
pub tex_rect: IntRect,
|
||||||
pub layer: Layer::SpecificDef,
|
pub layer: Layer::SpecificDef,
|
||||||
|
pub blend_graphic: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Inspect, Default, Serialize, Deserialize)]
|
#[derive(Debug, Inspect, Default, Serialize, Deserialize)]
|
||||||
|
|
@ -179,6 +183,7 @@ where
|
||||||
graphic_name: Default::default(),
|
graphic_name: Default::default(),
|
||||||
tex_rect: Default::default(),
|
tex_rect: Default::default(),
|
||||||
layer: Layer::SpecificDef::default(),
|
layer: Layer::SpecificDef::default(),
|
||||||
|
blend_graphic: String::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,46 +5,10 @@ use crate::{
|
||||||
math::TILE_SIZE,
|
math::TILE_SIZE,
|
||||||
};
|
};
|
||||||
#[derive(Debug, Default, Inspect)]
|
#[derive(Debug, Default, Inspect)]
|
||||||
pub struct TileDbEdit {
|
pub(crate) struct TileDbEdit {}
|
||||||
open: bool,
|
|
||||||
#[opaque]
|
|
||||||
layer: Layer,
|
|
||||||
}
|
|
||||||
impl TileDbEdit {
|
impl TileDbEdit {
|
||||||
pub(crate) fn ui(&mut self, ctx: &egui::Context, tile_db: &mut TileDb) {
|
pub(crate) fn ui(&mut self, ctx: &egui::Context, tile_db: &mut TileDb) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
|
||||||
enum Layer {
|
|
||||||
Bg,
|
|
||||||
Fg,
|
|
||||||
Mid,
|
|
||||||
}
|
|
||||||
impl Default for Layer {
|
|
||||||
fn default() -> Self {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
use super::{Bg, Fg, Mid, TileDb, TileDef, TileLayer, DEFAULT_TILE_BB};
|
use super::{Bg, Fg, Mid, TileDb, TileDef, TileLayer, DEFAULT_TILE_BB};
|
||||||
trait SpecialUi {
|
|
||||||
fn special_ui(&mut self, ui: &mut egui::Ui);
|
|
||||||
}
|
|
||||||
impl SpecialUi for TileDef<Mid> {
|
|
||||||
fn special_ui(&mut self, ui: &mut egui::Ui) {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl SpecialUi for TileDef<Bg> {
|
|
||||||
fn special_ui(&mut self, _ui: &mut egui::Ui) {}
|
|
||||||
}
|
|
||||||
impl SpecialUi for TileDef<Fg> {
|
|
||||||
fn special_ui(&mut self, _ui: &mut egui::Ui) {}
|
|
||||||
}
|
|
||||||
fn db_ui<Layer: TileLayer + Debug>(db: &mut Vec<TileDef<Layer>>, ui: &mut egui::Ui)
|
|
||||||
where
|
|
||||||
<Layer as TileLayer>::SpecificDef: Debug + Default + Inspect,
|
|
||||||
TileDef<Layer>: SpecialUi,
|
|
||||||
{
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
125
src/world.rs
125
src/world.rs
|
|
@ -9,51 +9,33 @@ use crate::{
|
||||||
world::reg_chunk_existence::ExistenceBitset, worldgen::Worldgen,
|
world::reg_chunk_existence::ExistenceBitset, worldgen::Worldgen,
|
||||||
};
|
};
|
||||||
use self::serialization::save_chunk;
|
use self::serialization::save_chunk;
|
||||||
pub type ChkPosSc = u16;
|
|
||||||
#[derive(Hash, PartialEq, Eq, Debug, Clone, Copy, Inspect)]
|
#[derive(Hash, PartialEq, Eq, Debug, Clone, Copy, Inspect)]
|
||||||
pub struct ChunkPos {
|
pub(crate) struct ChunkPos {}
|
||||||
pub x: ChkPosSc,
|
|
||||||
pub y: ChkPosSc,
|
|
||||||
}
|
|
||||||
impl ChunkPos {
|
|
||||||
/// Returns the region this chunk position belongs to
|
|
||||||
pub fn region(&self) -> (u8, u8) {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
/// Returns the local position in the region (0-7)
|
|
||||||
pub fn local(&self) -> (u8, u8) {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
pub struct World {
|
pub(crate) struct World {
|
||||||
/// The currently loaded chunks
|
pub(crate) player: Player,
|
||||||
chunks: FnvHashMap<ChunkPos, Chunk>,
|
|
||||||
/// This is the number of ticks since the world has started.
|
|
||||||
/// In other words, the age of the world.
|
|
||||||
pub ticks: u64,
|
|
||||||
pub player: Player,
|
|
||||||
pub name: String,
|
|
||||||
#[opaque]
|
|
||||||
pub path: PathBuf,
|
|
||||||
}
|
}
|
||||||
impl World {
|
impl World {
|
||||||
pub fn new(spawn_point: WorldPos, name: &str, path: PathBuf) -> Self {
|
pub(crate) fn new(spawn_point: WorldPos, name: &str, path: PathBuf) -> Self {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
/// Get mutable access to the tile at `pos`.
|
/// Get mutable access to the tile at `pos`.
|
||||||
///
|
///
|
||||||
/// Loads or generates the containing chunk if necessary.
|
/// Loads or generates the containing chunk if necessary.
|
||||||
pub fn tile_at_mut(&mut self, pos: TilePos, worldgen: &Worldgen) -> &mut Tile {
|
pub(crate) fn tile_at_mut(
|
||||||
|
&mut self,
|
||||||
|
pos: TilePos,
|
||||||
|
worldgen: &Worldgen,
|
||||||
|
) -> &mut Tile {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn save(&self) {
|
pub(crate) fn save(&self) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn save_meta(&self) {
|
pub(crate) fn save_meta(&self) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
pub fn save_chunks(&self) {
|
pub(crate) fn save_chunks(&self) {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -71,89 +53,24 @@ fn format_reg_file_name((x, y): (u8, u8)) -> String {
|
||||||
}
|
}
|
||||||
const CHUNK_BYTES: usize = CHUNK_N_TILES * TILE_BYTES;
|
const CHUNK_BYTES: usize = CHUNK_N_TILES * TILE_BYTES;
|
||||||
const TILE_BYTES: usize = 3 * 2;
|
const TILE_BYTES: usize = 3 * 2;
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
struct WorldMetaSave {
|
|
||||||
name: String,
|
|
||||||
ticks: u64,
|
|
||||||
}
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub struct TilePos {
|
pub(crate) struct TilePos {}
|
||||||
pub x: TPosSc,
|
|
||||||
pub y: TPosSc,
|
|
||||||
}
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
pub struct ChunkLocalTilePos {
|
pub(crate) struct ChunkLocalTilePos {}
|
||||||
pub x: ChkLocalTPosSc,
|
|
||||||
pub y: ChkLocalTPosSc,
|
|
||||||
}
|
|
||||||
/// Chunk-local tile position scalar. Supports up to 256 tiles per chunk.
|
/// Chunk-local tile position scalar. Supports up to 256 tiles per chunk.
|
||||||
type ChkLocalTPosSc = u8;
|
type ChkLocalTPosSc = u8;
|
||||||
impl TilePos {
|
pub(crate) type TPosSc = u32;
|
||||||
pub fn to_chunk_and_local(self) -> (ChunkPos, ChunkLocalTilePos) {
|
pub(crate) const CHUNK_EXTENT: u16 = 128;
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub(crate) fn to_chunk(self) -> ChunkPos {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn chk_pos(tile: TPosSc) -> ChkPosSc {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn test_chk_pos() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
fn chunk_local(global: TPosSc) -> ChkLocalTPosSc {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn test_chunk_local() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn test_to_chunk_and_local() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub type TPosSc = u32;
|
|
||||||
pub const CHUNK_EXTENT: u16 = 128;
|
|
||||||
const CHUNK_N_TILES: usize = CHUNK_EXTENT as usize * CHUNK_EXTENT as usize;
|
const CHUNK_N_TILES: usize = CHUNK_EXTENT as usize * CHUNK_EXTENT as usize;
|
||||||
type ChunkTiles = [Tile; CHUNK_N_TILES];
|
type ChunkTiles = [Tile; CHUNK_N_TILES];
|
||||||
fn default_chunk_tiles() -> ChunkTiles {
|
fn default_chunk_tiles() -> ChunkTiles {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
#[derive(Debug, Inspect)]
|
#[derive(Debug, Inspect)]
|
||||||
pub struct Chunk {
|
pub(crate) struct Chunk {}
|
||||||
tiles: ChunkTiles,
|
|
||||||
}
|
|
||||||
impl Chunk {
|
|
||||||
pub fn gen(pos: ChunkPos, worldgen: &Worldgen) -> Self {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub fn load_or_gen(chk: ChunkPos, worldgen: &Worldgen, world_path: &Path) -> Chunk {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
fn at_mut(&mut self, local: ChunkLocalTilePos) -> &mut Tile {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn chunk_exists(reg_path: &Path, pos: ChunkPos) -> bool {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
#[derive(Clone, Copy, Debug, Inspect)]
|
#[derive(Clone, Copy, Debug, Inspect)]
|
||||||
pub struct Tile {
|
pub(crate) struct Tile {}
|
||||||
/// Background wall behind entities
|
pub(crate) const REGION_CHUNK_EXTENT: u8 = 8;
|
||||||
pub bg: BgTileId,
|
pub(crate) const REGION_N_CHUNKS: u8 = REGION_CHUNK_EXTENT * REGION_CHUNK_EXTENT;
|
||||||
/// The solid wall on the same level as entities
|
|
||||||
pub mid: MidTileId,
|
|
||||||
/// A layer on top of the mid wall. Usually ores or decorative pieces.
|
|
||||||
pub fg: FgTileId,
|
|
||||||
}
|
|
||||||
pub const REGION_CHUNK_EXTENT: u8 = 8;
|
|
||||||
pub const REGION_N_CHUNKS: u8 = REGION_CHUNK_EXTENT * REGION_CHUNK_EXTENT;
|
|
||||||
/// This is the uncompressed byte length of a region
|
/// This is the uncompressed byte length of a region
|
||||||
pub const REGION_BYTES: usize = REGION_N_CHUNKS as usize * CHUNK_BYTES;
|
pub(crate) const REGION_BYTES: usize = REGION_N_CHUNKS as usize * CHUNK_BYTES;
|
||||||
#[allow(clippy::assertions_on_constants)]
|
|
||||||
const _: () = assert!(
|
|
||||||
REGION_N_CHUNKS <= 64,
|
|
||||||
"A region file uses an existence bitset that's a 64 bit integer"
|
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,3 @@
|
||||||
use std::{fs::File, io::Read, path::Path};
|
use std::{fs::File, io::Read, path::Path};
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct ExistenceBitset(pub u64);
|
pub(crate) struct ExistenceBitset(pub u64);
|
||||||
impl ExistenceBitset {
|
|
||||||
pub const EMPTY: Self = Self(0);
|
|
||||||
pub fn read_from_file(f: &mut File) -> ExistenceBitset {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub fn read_from_fs(path: &Path) -> ExistenceBitset {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::fmt::Debug for ExistenceBitset {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,3 @@ use super::{default_chunk_tiles, loc_byte_idx_xy, Chunk, ChunkPos};
|
||||||
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 {}
|
||||||
}
|
}
|
||||||
const COMP_LEVEL: i32 = 9;
|
|
||||||
impl Chunk {
|
|
||||||
pub fn load_from_region(data: &[u8], x: u8, y: u8) -> Self {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn test_chunk_seri() {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,4 @@ use crate::{
|
||||||
tiles::{BgTileId, FgTileId, MidTileId, TileId},
|
tiles::{BgTileId, FgTileId, MidTileId, TileId},
|
||||||
world::{ChunkPos, Tile as Tl, CHUNK_EXTENT},
|
world::{ChunkPos, Tile as Tl, CHUNK_EXTENT},
|
||||||
};
|
};
|
||||||
pub struct Worldgen {
|
pub(crate) struct Worldgen {}
|
||||||
world: World<crate::world::Tile>,
|
|
||||||
}
|
|
||||||
impl Worldgen {
|
|
||||||
pub fn from_seed(seed: i64) -> Self {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
pub fn chunk_noise(&self, pos: ChunkPos) -> Vec<Vec<Tl>> {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue