mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
Add tile graphic
This commit is contained in:
parent
d78726eb5b
commit
fbc7e35f9e
11 changed files with 812 additions and 20 deletions
28
src/game.rs
28
src/game.rs
|
|
@ -1,16 +1,22 @@
|
|||
use crate::{math::WorldPos, world::World};
|
||||
use sfml::graphics::{RenderTarget, RenderWindow, Sprite};
|
||||
|
||||
use crate::{math::WorldPos, res::Res, world::World};
|
||||
|
||||
pub struct GameState {
|
||||
transient: TransientGameState,
|
||||
persistent: PersistentGameState,
|
||||
}
|
||||
|
||||
/// Transient game state, not saved to disk
|
||||
pub struct TransientGameState {
|
||||
camera_offset: WorldPos,
|
||||
}
|
||||
|
||||
/// Persistent game state, saved to disk
|
||||
pub struct PersistentGameState {
|
||||
world: World,
|
||||
}
|
||||
impl GameState {
|
||||
pub(crate) fn draw_world(&mut self, rw: &mut RenderWindow, res: &Res) {
|
||||
rw.draw(&Sprite::with_texture(&res.tile_atlas));
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for GameState {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
camera_offset: WorldPos { x: 0, y: 0 },
|
||||
world: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue