mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 12:25:02 +01:00
Initial commit
Basic skeleton
This commit is contained in:
commit
d5c9e24201
6 changed files with 514 additions and 0 deletions
32
src/graphics.rs
Normal file
32
src/graphics.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
use sfml::{
|
||||
graphics::RenderWindow,
|
||||
window::{ContextSettings, Style, VideoMode},
|
||||
};
|
||||
|
||||
struct ScreenRes {
|
||||
w: u16,
|
||||
h: u16,
|
||||
}
|
||||
|
||||
impl ScreenRes {
|
||||
fn to_sf(&self) -> VideoMode {
|
||||
VideoMode {
|
||||
width: self.w.into(),
|
||||
height: self.h.into(),
|
||||
bits_per_pixel: 32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const NATIVE_RESOLUTION: ScreenRes = ScreenRes { w: 640, h: 360 };
|
||||
|
||||
pub fn make_window() -> RenderWindow {
|
||||
let mut rw = RenderWindow::new(
|
||||
NATIVE_RESOLUTION.to_sf(),
|
||||
"Mantle Diver",
|
||||
Style::CLOSE,
|
||||
&ContextSettings::default(),
|
||||
);
|
||||
rw.set_framerate_limit(60);
|
||||
rw
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue