use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct WindowConfig {
pub title: String,
pub width: u32,
pub height: u32,
pub resizable: bool,
pub fullscreen: bool,
}
#[derive(Debug)]
pub struct Window {
config: WindowConfig,
handle: Option<WindowHandle>,
}
#[derive(Debug)]
pub struct WindowHandle {
id: u32,
}
impl WindowConfig {
pub fn default(title: &str) -> Self {
Self { title: title.to_string(), width: 800, height: 600, resizable: true, fullscreen: false }
}
}
impl Window {
pub fn new(config: WindowConfig) -> Self {
Self { config, handle: None }
}
pub fn set_title(&mut self, title: &str) {
self.config.title = title.to_string();
}
pub fn set_size(&mut self, width: u32, height: u32) {
self.config.width = width;
self.config.height = height;
}
pub fn show(&mut self) {
}
pub fn hide(&mut self) {
}
pub fn close(&mut self) {
}
pub fn config(&self) -> &WindowConfig {
&self.config
}
pub fn handle(&self) -> Option<&WindowHandle> {
self.handle.as_ref()
}
}