yaldabaranth 0.0.0

A roguelike. (Coming soon!)
use raylib::prelude::*;

use crate::engine::display::Display;

#[derive(Clone, Debug)]
pub struct GameConfig {
    pub width: u32,
    pub height: u32,
    pub title: String,
}
impl GameConfig {
    pub fn init_raylib(&self) -> (RaylibHandle, RaylibThread) {
        return raylib::init()
            .size(self.width as i32, self.height as i32)
            .title(self.title.as_str())
            .build();
    }
}

/// The main struct for the game. It is repsonsible for
/// managing the game's different subsystems. Each subsystem,
/// insofar as it makes sense, will run on its own thread.
pub struct Game {
    config: GameConfig,
    display: Display,
}
impl Game {
    pub fn new(config: GameConfig) -> Self {
        let display = Display::new(config.clone());
        Self { config, display }
    }
    pub fn run(self) {
        while !self.display.poll_events() {}
    }
}