pub fn new<W: Window + 'static, L: Layer + 'static>() -> Result<Self> {
        let config = WindowConfig {
            debug: true,
            gl_version: (4, 5),
            width: 900,
            height: 700,
            resizable: true,
            title: "Game",
        };

        let mut window = W::new(config)?;

        let gl = window.new_gl_context()?;

        #[cfg(debug_assertions)]
        enable_gl_debugging(&gl);

        let state = EngineState {
            gl,
            renderer: Renderer::new(window.renderer()?),
            window: Box::new(window),
            inputs: Default::default(),
            run_time: 0.0,
        };

        // vec capacity 4 is completely arbitary, could increase/decrease later
        // depending on layer stack size
        let mut this = MainLoop {
            layers: Vec::with_capacity(4),
            state,
            update_order: Vec::with_capacity(4),
            render_order: Vec::with_capacity(4),
        };

        // For the first layer, push goes directly onto the layer stack as there
        // isn't anything else to intefere, so no point allocating a new vec.
        // Ignores poping any states in this method as there should be no use
        // so don't bother trying to deal with it.
        let mut state_ref = EngineStateRef {
            layer_push: &mut this.layers,
            state: &mut this.state,
            layer_pop: &mut Vec::with_capacity(0),
            layer_id: 0,
        };

        let first_layer = Box::new(L::new(&mut state_ref)?);

        // Insert the first layer in index 0, as it should be first, regardless
        // of what else was pushed during its initialisation.
        this.layers.insert(0, first_layer);

        // this needs to be called any time self.layers is modified
        this.set_call_order();

        Ok(this)
    }
/// Try to create a new game engine instance, using default settings
/// Currently there is no way to change the settings used, this should
/// probably be changed.  This method initialises the graphics and creates
/// a window that will be shown to the user.
Try to create a new game engine instance, using default settings
Currently there is no way to change the settings used, this should
probably be changed.  This method initialises the graphics and creates
a window that will be shown to the user.
Try to create a new game engine instance using default settings Currently there is no way to change the settings used this should probably be changed . This method initialises the graphics and creates a window that will be shown to the user .
pub fn new<W: Window + 'static, L: Layer + 'static>() -> Result<Self> {
        let config = WindowConfig {
            debug: true,
            gl_version: (4, 5),
            width: 900,
            height: 700,
            resizable: true,
            title: "Game",
        };
        let mut window = W::new(config)?;
        let gl = window.new_gl_context()?;
        #[cfg(debug_assertions)]
        enable_gl_debugging(&gl);
        let state = EngineState {
            gl,
            renderer: Renderer::new(window.renderer()?),
            window: Box::new(window),
            inputs: Default::default(),
            run_time: 0.0,
        };
        // vec capacity 4 is completely arbitary, could increase/decrease later
        // depending on layer stack size
        let mut this = MainLoop {
            layers: Vec::with_capacity(4),
            state,
            update_order: Vec::with_capacity(4),
            render_order: Vec::with_capacity(4),
        };
        // For the first layer, push goes directly onto the layer stack as there
        // isn't anything else to intefere, so no point allocating a new vec.
        // Ignores poping any states in this method as there should be no use
        // so don't bother trying to deal with it.
        let mut state_ref = EngineStateRef {
            layer_push: &mut this.layers,
            state: &mut this.state,
            layer_pop: &mut Vec::with_capacity(0),
            layer_id: 0,
        };
        let first_layer = Box::new(L::new(&mut state_ref)?);
        // Insert the first layer in index 0, as it should be first, regardless
        // of what else was pushed during its initialisation.
        this.layers.insert(0, first_layer);
        // this needs to be called any time self.layers is modified
        this.set_call_order();
        Ok(this)
    }
pub fn new < W : Window + ' static , L : Layer + ' static > ( ) -> Result < Self > { let config = WindowConfig { debug : true , gl_version : ( 4 , 5 ) , width : 900 , height : 700 , resizable : true , title : " " , } ; let mut window = W :: new ( config ) ? ; let gl = window . new_gl_context ( ) ? ; # [ cfg ( debug_assertions ) ] enable_gl_debugging ( & gl ) ; let state = EngineState { gl , renderer : Renderer :: new ( window . renderer ( ) ? ) , window : Box :: new ( window ) , inputs : Default :: default ( ) , run_time : 0.0 , } ; // vec capacity 4 is completely arbitary, could increase/decrease later // depending on layer stack size let mut this = MainLoop { layers : Vec :: with_capacity ( 4 ) , state , update_order : Vec :: with_capacity ( 4 ) , render_order : Vec :: with_capacity ( 4 ) , } ; // For the first layer, push goes directly onto the layer stack as there // isn't anything else to intefere, so no point allocating a new vec. // Ignores poping any states in this method as there should be no use // so don't bother trying to deal with it. let mut state_ref = EngineStateRef { layer_push : & mut this . layers , state : & mut this . state , layer_pop : & mut Vec :: with_capacity ( 0 ) , layer_id : 0 , } ; let first_layer = Box :: new ( L :: new ( & mut state_ref ) ? ) ; // Insert the first layer in index 0, as it should be first, regardless // of what else was pushed during its initialisation. this . layers . insert ( 0 , first_layer ) ; // this needs to be called any time self.layers is modified this . set_call_order ( ) ; Ok ( this ) }
Try to create a new game engine instance, using default settings
Currently there is no way to change the settings used, this should
probably be changed.
Try to create a new game engine instance using default settings Currently there is no way to change the settings used this should probably be changed .