JugarEngine

Struct JugarEngine 

Source
pub struct JugarEngine { /* private fields */ }
Expand description

The main Jugar game engine

Implementations§

Source§

impl JugarEngine

Source

pub fn new(config: JugarConfig) -> Self

Creates a new Jugar engine with the given configuration

Source

pub const fn config(&self) -> &JugarConfig

Gets the configuration

Source

pub const fn time(&self) -> &Time

Gets the current time

Source

pub const fn viewport(&self) -> &Viewport

Gets the viewport

Source

pub fn viewport_mut(&mut self) -> &mut Viewport

Gets the viewport mutably

Source

pub const fn input(&self) -> &InputState

Gets the input state

Source

pub fn input_mut(&mut self) -> &mut InputState

Gets the input state mutably

Source

pub const fn audio(&self) -> &AudioSystem

Gets the audio system

Source

pub fn audio_mut(&mut self) -> &mut AudioSystem

Gets the audio system mutably

Source

pub const fn world(&self) -> &World

Gets the ECS world

Source

pub fn world_mut(&mut self) -> &mut World

Gets the ECS world mutably

Source

pub const fn physics(&self) -> &PhysicsWorld

Gets the physics world

Source

pub fn physics_mut(&mut self) -> &mut PhysicsWorld

Gets the physics world mutably

Source

pub const fn ui(&self) -> &UiContainer

Gets the UI container

Source

pub fn ui_mut(&mut self) -> &mut UiContainer

Gets the UI container mutably

Source

pub const fn game_loop(&self) -> &GameLoop

Gets the game loop

Source

pub fn resize(&mut self, width: u32, height: u32)

Resizes the viewport

Source

pub const fn is_running(&self) -> bool

Checks if the engine is running

Source

pub fn run<F>(&mut self, callback: F)
where F: FnMut(&mut Self) -> LoopControl,

Runs the game loop with a callback

The callback receives a reference to the engine and returns LoopControl.

Source

pub fn step(&mut self, delta: f32)

Steps the engine for a single frame (useful for testing)

Source

pub fn stop(&mut self)

Stops the engine

Trait Implementations§

Source§

impl Debug for JugarEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for JugarEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.