Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime<'a> { /* private fields */ }
Expand description

Per-frame access to frontend callbacks and services.

Runtime is passed to Core::run, Core::load_game, and hardware context hooks. It owns typed helpers for input polling, video/audio submission, frontend messages, hardware framebuffers, memory maps, and service queries.

Implementations§

Source§

impl<'a> Runtime<'a>

Source

pub fn environment(&mut self) -> Environment<'_>

Source

pub fn logger(&mut self) -> Logger

Source

pub fn poll_input(&self)

Source

pub fn joypad_pressed( &self, port: impl Into<InputPort>, button: JoypadButton, ) -> bool

Source

pub fn joypad_buttons(&self, port: impl Into<InputPort>) -> JoypadButtonSet

Source

pub fn analog_axis( &self, port: impl Into<InputPort>, stick: AnalogStick, axis: AnalogAxis, ) -> i16

Source

pub fn analog_button( &self, port: impl Into<InputPort>, button: JoypadButton, ) -> i16

Source

pub fn mouse_axis(&self, port: impl Into<InputPort>, axis: MouseAxis) -> i16

Source

pub fn mouse_button_pressed( &self, port: impl Into<InputPort>, button: MouseButton, ) -> bool

Source

pub fn mouse_wheel_moved( &self, port: impl Into<InputPort>, direction: MouseWheel, ) -> bool

Source

pub fn pointer_axis( &self, port: impl Into<InputPort>, index: impl Into<PointerIndex>, axis: PointerAxis, ) -> i16

Source

pub fn pointer_pressed( &self, port: impl Into<InputPort>, index: impl Into<PointerIndex>, ) -> bool

Source

pub fn pointer_count(&self, port: impl Into<InputPort>) -> i16

Source

pub fn pointer_is_offscreen( &self, port: impl Into<InputPort>, index: impl Into<PointerIndex>, ) -> bool

Source

pub fn lightgun_axis( &self, port: impl Into<InputPort>, axis: LightgunAxis, ) -> i16

Source

pub fn lightgun_button_pressed( &self, port: impl Into<InputPort>, button: LightgunButton, ) -> bool

Source

pub fn lightgun_is_offscreen(&self, port: impl Into<InputPort>) -> bool

Source

pub fn video_refresh_frame<T>( &self, pixels: &[T], width: u32, height: u32, pitch: usize, ) -> bool

Source

pub fn video_refresh_frame_with_audio<T>( &self, pixels: &[T], width: u32, height: u32, pitch: usize, audio_frames: &[[i16; 2]], ) -> usize

Source

pub fn video_refresh_hw(&self, width: u32, height: u32, pitch: usize)

Source

pub fn video_refresh_hw_with_audio( &self, width: u32, height: u32, pitch: usize, audio_frames: &[[i16; 2]], ) -> usize

Source

pub fn video_refresh_software_framebuffer( &self, framebuffer: SoftwareFramebuffer, )

Source

pub fn video_refresh_software_framebuffer_with_audio( &self, framebuffer: SoftwareFramebuffer, audio_frames: &[[i16; 2]], ) -> usize

Source

pub fn video_refresh_dupe(&self, width: u32, height: u32)

Source

pub fn video_refresh_dupe_with_audio( &self, width: u32, height: u32, audio_frames: &[[i16; 2]], ) -> usize

Source

pub fn set_geometry(&mut self, geometry: GameGeometry) -> bool

Source

pub fn set_message(&mut self, message: impl AsRef<str>, frames: u32) -> bool

Source

pub fn set_message_ext(&mut self, message: ExtendedMessage) -> bool

Source

pub fn audio_sample(&self, left: i16, right: i16)

Source

pub fn audio_sample_batch(&self, frames: &[[i16; 2]]) -> usize

Source

pub fn current_framebuffer(&self) -> Option<u32>

Source

pub fn hw_context_type(&self) -> Option<HwContextType>

Source

pub fn hw_proc_address(&self, symbol: &str) -> Result<*const c_void, String>

Auto Trait Implementations§

§

impl<'a> Freeze for Runtime<'a>

§

impl<'a> !RefUnwindSafe for Runtime<'a>

§

impl<'a> Send for Runtime<'a>

§

impl<'a> !Sync for Runtime<'a>

§

impl<'a> Unpin for Runtime<'a>

§

impl<'a> UnsafeUnpin for Runtime<'a>

§

impl<'a> !UnwindSafe for Runtime<'a>

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.