pub struct Engine<'a> {
pub resource_db: ResourceDatabase,
pub resource_loader: ResourceLoader,
pub frame_arena: LinearAllocator<'a>,
pub thread_pool: ThreadPool,
pub audio_mixer: Mixer,
pub event_queue: EventQueue,
}
Expand description
The top-level structure of the game engine which owns all the runtime state of the game engine and has methods for running the engine.
Fields§
§resource_db: ResourceDatabase
Database of the non-code parts of the game, e.g. sprites.
resource_loader: ResourceLoader
Queue of loading tasks which insert loaded chunks into the resource_db
occasionally.
frame_arena: LinearAllocator<'a>
Linear allocator for any frame-internal dynamic allocation needs. Reset at the start of each frame.
thread_pool: ThreadPool
Thread pool for splitting compute-heavy workloads to multiple threads.
audio_mixer: Mixer
Mixer for playing back audio.
event_queue: EventQueue
Queued up events from the platform layer. Discarded after
being used by the game to trigger an action via
InputDeviceState
, or after
a timeout if not.
Implementations§
Source§impl Engine<'_>
impl Engine<'_>
Sourcepub fn new(
platform: &dyn Platform,
arena: &'static LinearAllocator<'_>,
limits: EngineLimits,
) -> Self
pub fn new( platform: &dyn Platform, arena: &'static LinearAllocator<'_>, limits: EngineLimits, ) -> Self
Creates a new instance of the engine.
platform
: the platform implementation to be used for this instance of the engine.arena
: an arena for all the persistent memory the engine requires, e.g. the resource database.limits
: defines the limits for the various subsystems of the engine, for dialing in the appropriate tradeoffs between memory usage and game requirements.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for Engine<'a>
impl<'a> !RefUnwindSafe for Engine<'a>
impl<'a> !Send for Engine<'a>
impl<'a> Sync for Engine<'a>
impl<'a> Unpin for Engine<'a>
impl<'a> !UnwindSafe for Engine<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more