Struct gym_rs::utils::custom::screen::Screen

source ·
pub struct Screen { /* private fields */ }
Expand description

Defines a wrapper over SDL2, similar to PyGame to enable rapid development of GUI environments.

Implementations§

source§

impl Screen

source

pub fn new( height: u32, width: u32, title: &'static str, render_fps: u32, mode: RenderMode ) -> Self

Constructs a new Screen.

source§

impl Screen

source

pub fn close(&mut self)

Closes the process responsible for rendering the environment.

source

pub fn is_open(&self) -> bool

Checks whether the screen is still available.

source

pub fn render(&mut self, mode: RenderMode) -> Renders

Outputs the contents found in the GUI buffer to the display surface.

source

pub fn screen_width(&self) -> u32

Outputs the width of the internal screen generated.

source

pub fn draw_on_canvas( &mut self, using_fn: impl FnMut(&mut WindowCanvas), with_transformations: ScreenGuiTransformations )

Draws new content on the canvas using the closure and transformation instructions provided.

source

pub fn consume_events(&mut self)

Processes all events found in the queue.

source

pub fn load_gui(&mut self)

Generates a window to begin displaying content on.

Trait Implementations§

source§

impl Clone for Screen

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Screen

source§

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

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

impl Serialize for Screen

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Screen

§

impl !Send for Screen

§

impl !Sync for Screen

§

impl Unpin for Screen

§

impl UnwindSafe for Screen

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V