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

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)

KeyDown(VirtualKeyCode)

KeyPress(VirtualKeyCode)

KeyRelease(VirtualKeyCode)

Gesture(GestureEvent)

Other(OtherEvent)

Async(AsyncEvent)

Implementations

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

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);

Returns the filename like it will appear in a file.

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

A simple way to parse a value. It does a split on the string, which basically means it needs to follow the pattern Create_0 and similar.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Return EventType::Create

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.