Crate platform

Source
Expand description

This crate mainly revolves around the Platform trait, which can be implemented to provide a “platform implementation” for the game engine. Otherwise, this crate mostly contains some low-level parts of the engine which are necessarily needed to implement Platform, such as some multithreading utilities.

This is split off of the main engine crate so that the engine and the platform implementation can be compiled independently, which appears to speed up compilation time.

Re-exports§

pub use thread_pool::TaskChannel;
pub use thread_pool::ThreadState;

Modules§

channel
Static memory based single-producer single-consumer channel for communication between threads.
thread_pool
Thread pool for running tasks on other threads.

Structs§

Box
Owned pointer to a T.
Button
A button or key on a specific input device.
DrawSettings2D
Various options for controlling how draw commands should be executed.
FileHandle
Platform-specific file handle.
FileReadTask
Handle to an asynchronous file reading operation.
InputDevice
A specific input device.
Instant
Analogous to the standard library Instant type, representing a point in time.
Semaphore
Atomically counting semaphore for efficiently waiting on other threads, intended to be created by the platform implementation, making use of OS synchronization primitives.
SpriteRef
Platform-specific sprite reference.
Vertex2D
Vertex describing a 2D point with a texture coordinate and a color.

Enums§

ActionCategory
Generic action categories for which default buttons are provided. Can be used by games to set up their default mappings for any input device. Different categories may map to the same buttons, so making inputs inputs context-sensitive are recommended.
BlendMode
How drawn pixels are blended with the previously drawn pixels.
Event
An input event sent by the platform to the engine for handling.
PixelFormat
Descriptions of pixel data layouts, used to interpret the byte arrays passed into uploading functions.
TextureFilter
How the texture is filtered when magnified or minified.

Constants§

AUDIO_CHANNELS
The amount of channels of audio data played back by the engine.
AUDIO_SAMPLE_RATE
Sample rate for the audio data played back by the engine.

Traits§

EngineCallbacks
Interface to the engine for the platform implementation.
Platform
A trait for using platform-dependent features from the engine without depending on any platform implementation directly. A platform implementation should implement this trait, and also call the engine’s “iterate” and “event” methods at appropriate times.
SemaphoreImpl
A trait to implement a semaphore object.

Type Aliases§

InputDevices
Shorthand for an ArrayVec of InputDevice.