My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/games/rstnode/rst-client/src/ctx.rs

30 lines
908 B

//! Small context builder
use crate::{
constants::{AUTHORS, NAME, VERSION},
GameSettings,
};
use ggez::{
conf::{WindowMode, WindowSetup},
ContextBuilder,
};
/// Construct a context builder with default & user window settings
pub fn build(settings: &GameSettings) -> ContextBuilder {
ContextBuilder::new(NAME, AUTHORS)
.window_setup(WindowSetup {
title: format!("{} (v{})", NAME, VERSION),
samples: (&settings.graphics.samples).into(),
vsync: settings.graphics.vsync,
icon: "".into(),
srgb: true,
})
.window_mode(WindowMode {
width: settings.window.width as f32,
height: settings.window.height as f32,
maximized: settings.window.window_mode.maximized(),
fullscreen_type: settings.window.window_mode._type(),
..Default::default()
})
}