Memory

Struct Memory 

Source
pub struct Memory {
    pub logger: Box<dyn Fn(&str)>,
    pub graphics: Vec<u8>,
    pub fontatlas: Vec<bool>,
    pub map: Vec<u8>,
    pub sprites: Vec<u8>,
    pub flags: Vec<u8>,
    pub buttons: Vec<bool>,
    pub pallete: Vec<ColorState>,
    pub camera: Vector,
    pub rng: ThreadRng,
}

Fields§

§logger: Box<dyn Fn(&str)>§graphics: Vec<u8>§fontatlas: Vec<bool>§map: Vec<u8>§sprites: Vec<u8>§flags: Vec<u8>§buttons: Vec<bool>§pallete: Vec<ColorState>§camera: Vector§rng: ThreadRng

Implementations§

Source§

impl Memory

Source

pub fn new( map: String, sprites: String, flags: String, fontatlas: String, ) -> Memory

Source

pub fn spr(&mut self, sprite: u8, x: i32, y: i32, flip: Option<FlipState>)

Source

pub fn map( &mut self, celx: u8, cely: u8, sx: i32, sy: i32, celw: u8, celh: u8, mask: u8, )

Source

pub fn circfill(&mut self, xc: u8, yc: u8, r: i8, c: u8)

Source

pub fn draw_circ(&mut self, xc: i32, yc: i32, x: i32, y: i32, c: u8)

Source

pub fn rrectfill(&mut self, x: i32, y: i32, x1: i32, y1: i32, col: u8)

Source

pub fn camera(&mut self, x: f32, y: f32)

Source

pub fn rectfill(&mut self, x: i32, y: i32, x2: i32, y2: i32, c: u8)

Source

pub fn pal(&mut self, index: usize, color: u8)

Source

pub fn palt(&mut self, index: usize, transparent: bool)

Source

pub fn pal_reset(&mut self)

Source

pub fn print(&mut self, text: &str, x: i32, y: i32, col: u8)

Source

pub fn pset(&mut self, col: u8, x: i32, y: i32)

Source

pub fn mget(&self, x: u8, y: u8) -> u8

Source

pub fn mset(&mut self, x: u8, y: u8, tile: u8)

Source

pub fn fget(&self, sprnum: u8, idx: u8) -> bool

Source

pub fn fget_all(&self, sprnum: u8) -> u8

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Memory

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Memory

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 Freeze for Memory

§

impl !RefUnwindSafe for Memory

§

impl !Send for Memory

§

impl !Sync for Memory

§

impl Unpin for Memory

§

impl !UnwindSafe for Memory

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

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,