mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 04:25:00 +01:00
lööp
This commit is contained in:
parent
40e412c024
commit
98dd54f1f2
18 changed files with 196 additions and 1445 deletions
|
|
@ -1,55 +1,33 @@
|
|||
use egui_inspect::derive::Inspect;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sfml::{
|
||||
graphics::RenderWindow,
|
||||
system::Vector2f,
|
||||
window::{ContextSettings, Style, VideoMode},
|
||||
graphics::RenderWindow, system::Vector2f, window::{ContextSettings, Style, VideoMode},
|
||||
};
|
||||
use sfml_xt::graphics::RenderWindowExt;
|
||||
|
||||
use crate::math::FPS_TARGET;
|
||||
|
||||
pub struct ScreenRes {
|
||||
pub w: u16,
|
||||
pub h: u16,
|
||||
}
|
||||
|
||||
impl ScreenRes {
|
||||
fn to_sf(&self) -> VideoMode {
|
||||
VideoMode {
|
||||
width: self.w as _,
|
||||
height: self.h as _,
|
||||
bits_per_pixel: 32,
|
||||
}
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Copy, Debug, Inspect, Serialize, Deserialize)]
|
||||
pub struct ScreenVec {
|
||||
pub x: ScreenSc,
|
||||
pub y: ScreenSc,
|
||||
}
|
||||
|
||||
/// Screen position/offset scalar
|
||||
/// We assume this game won't be played above 32767*32767 resolution
|
||||
pub type ScreenSc = i16;
|
||||
|
||||
impl ScreenVec {
|
||||
pub fn to_sf_vec(self) -> Vector2f {
|
||||
Vector2f::new(self.x.into(), self.y.into())
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
const DEFAULT_RES: ScreenRes = ScreenRes { w: 960, h: 540 };
|
||||
|
||||
pub fn make_window() -> RenderWindow {
|
||||
let mut rw = RenderWindow::new(
|
||||
DEFAULT_RES.to_sf(),
|
||||
"Mantle Diver",
|
||||
Style::DEFAULT,
|
||||
&ContextSettings::default(),
|
||||
);
|
||||
rw.set_framerate_limit(FPS_TARGET.into());
|
||||
rw.center();
|
||||
rw
|
||||
loop {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue