//! Basic window setup code use crate::{ctx, state::ClientState, GameSettings}; use ggez::{ event::{self, EventLoop}, Context, }; pub struct Window { ctx: Context, eloop: EventLoop<()>, } impl Window { pub fn ctx(&mut self) -> &mut Context { &mut self.ctx } pub fn run(self, state: ClientState) -> ! { event::run(self.ctx, self.eloop, state) } } /// Start the main event loop with game settings and state pub fn create(settings: &GameSettings) -> Window { let (ctx, eloop) = ctx::build(settings).build().unwrap(); Window { ctx, eloop } }