[][src]Enum yy_typings::object_yy::EventType

pub enum EventType {
    Create,
    Destroy,
    Cleanup,
    Step(Stage),
    Alarm(usize),
    Draw(DrawEvent),
    Collision,
    Mouse(MouseEvent),
    KeyDown(VirtualKeyCode),
    KeyPress(VirtualKeyCode),
    KeyRelease(VirtualKeyCode),
    Gesture(GestureEvent),
    Other(OtherEvent),
    Async(AsyncEvent),
}

Describes the current event type. Users can make most events freely, though special care should be taken that Alarm's .0 field is less than ALARM_MAX, and the same for the OtherEvent's usize wrappers. To make sure some event has been validly created, is_valid has been provided.

Note: only serde_json serialization and deserialization is supported for EventType. Yaml, and other text / WYSIWYG data formats should be fine, but Bincode and other binary sequences are unlikely to succesfully serialize this. This is due to our use of serde's flatten, which runs afoul of this issue: https://github.com/servo/bincode/issues/245

Variants

Create
Destroy
Cleanup
Step(Stage)
Alarm(usize)
Draw(DrawEvent)
Collision
Mouse(MouseEvent)
KeyPress(VirtualKeyCode)
KeyRelease(VirtualKeyCode)
Gesture(GestureEvent)
Other(OtherEvent)
Async(AsyncEvent)

Implementations

impl EventType[src]

pub const ALARM_MAX: usize[src]

The maximum number of alarms which are available in the Gms2 IDE.

pub fn filename(&self) -> (&'static str, usize)[src]

Gets the filename for a given event with its requisite base. We return in this format to reduce allocating a string per call, as this filename will likely become allocated on some path in the future.

let (base_name, numeric_id) = EventType::Create;
assert_eq!(base_name, "Create_");
assert_eq!(numeric_id, 0);

pub fn parse_filename(
    value: &str,
    event_num: usize
) -> Result<EventType, EventTypeConvertErrors>
[src]

Parses a given filename and number into an EventType, if valid.

pub fn is_valid(value: EventType) -> bool[src]

Trait Implementations

impl Clone for EventType[src]

impl Copy for EventType[src]

impl Debug for EventType[src]

impl Default for EventType[src]

fn default() -> Self[src]

Return EventType::Create

impl<'de> Deserialize<'de> for EventType[src]

impl Eq for EventType[src]

impl From<EventType> for EventIntermediary[src]

impl Hash for EventType[src]

impl Ord for EventType[src]

impl PartialEq<EventType> for EventType[src]

impl PartialOrd<EventType> for EventType[src]

impl Serialize for EventType[src]

impl StructuralEq for EventType[src]

impl StructuralPartialEq for EventType[src]

impl TryFrom<EventIntermediary> for EventType[src]

type Error = EventTypeConvertErrors

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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