Slot

Struct Slot 

Source
pub struct Slot {}
Expand description

An interface for providing Dora SSR built-in node event names.

Implementations§

Source§

impl Slot

Source

pub const ACTION_END: &'static str = "Action"

The ActionEnd slot is triggered when an action is finished. Triggers after calling node.run_action(), node.perform(), node.run_action_def() and node.perform_def().

§Callback Arguments
  • action: Action - The finished action.
  • target: Node - The node that finished the action.
§Callback Example
node.perform_def(ActionDef::prop(1.0, 0.0, 100.0, Property::X, EaseType::Linear));
node.slot(Slot::ACTION_END, Box::new(|stack| {
	let (
		action,
		node
	) = match (
		stack.pop_cast::<Action>(),
		stack.pop_into_node()
	) {
		(Some(action), Some(node)) => (action, node),
		_ => return,
	};
}));
Source

pub const TAP_FILTER: &'static str = "TapFilter"

The TapFilter slot is triggered before the TapBegan slot and can be used to filter out certain taps. Triggers after setting node.set_touch_enabled(true).

§Callback Arguments
  • touch: Touch - The touch that triggered the tap.
§Callback Example
node.set_touch_enabled(true);
node.slot(Slot::TAP_FILTER, Box::new(|stack| {
	let touch = match stack.pop_cast::<Touch>() {
		Some(touch) => touch,
		None => return,
	};
	touch.set_enabled(false);
}));
Source

pub const TAP_BEGAN: &'static str = "TapBegan"

The TapBegan slot is triggered when a tap is detected. Triggers after setting node.set_touch_enabled(true).

§Callback Arguments
  • touch: Touch - The touch that triggered the tap.
§Callback Example
node.set_touch_enabled(true);
node.slot(Slot::TAP_BEGAN, Box::new(|stack| {
	let touch = match stack.pop_cast::<Touch>() {
		Some(touch) => touch,
		None => return,
	};
}));
Source

pub const TAP_ENDED: &'static str = "TapEnded"

The TapEnded slot is triggered when a tap ends. Triggers after setting node.set_touch_enabled(true).

§Callback Arguments
  • touch: Touch - The touch that triggered the tap.
§Callback Example
node.set_touch_enabled(true);
node.slot(Slot::TAP_ENDED, Box::new(|stack| {
	let touch = match stack.pop_cast::<Touch>() {
		Some(touch) => touch,
		None => return,
	};
}));
Source

pub const TAPPED: &'static str = "Tapped"

The Tapped slot is triggered when a tap is detected and has ended. Triggers after setting node.set_touch_enabled(true).

§Callback Arguments
  • touch: Touch - The touch that triggered the tap.
§Callback Example
node.set_touch_enabled(true);
node.slot(Slot::TAPPED, Box::new(|stack| {
	let touch = match stack.pop_cast::<Touch>() {
		Some(touch) => touch,
		None => return,
	};
}));
Source

pub const TAP_MOVED: &'static str = "TapMoved"

The TapMoved slot is triggered when a tap moves. Triggers after setting node.set_touch_enabled(true).

§Callback Arguments
  • touch: Touch - The touch that triggered the tap.
§Callback Example
node.set_touch_enabled(true);
node.slot(Slot::TAP_MOVED, Box::new(|stack| {
	let touch = match stack.pop_cast::<Touch>() {
		Some(touch) => touch,
		None => return,
	};
}));
Source

pub const MOUSE_WHEEL: &'static str = "MouseWheel"

The MouseWheel slot is triggered when the mouse wheel is scrolled. Triggers after setting node.set_touch_enabled(true).

§Callback Arguments
  • delta: Vec2 - The amount of scrolling that occurred.
§Callback Example
node.set_touch_enabled(true);
node.slot(Slot::MOUSE_WHEEL, Box::new(|stack| {
	let delta = match stack.pop_vec2() {
		Some(delta) => delta,
		None => return,
	};
}));
Source

pub const GESTURE: &'static str = "Gesture"

The Gesture slot is triggered when a gesture is recognized.

§Callback Arguments
  • center: Vec2 - The center of the gesture.
  • num_fingers: i32 - The number of fingers involved in the gesture.
  • delta_dist: f32 - The distance the gesture has moved.
  • delta_angle: f32 - The angle of the gesture.
§Callback Example
node.set_touch_enabled(true);
node.slot(Slot::GESTURE, Box::new(|stack| {
	let (
		center,
		num_fingers,
		delta_dist,
		delta_angle
	) = match (
		stack.pop_vec2(),
		stack.pop_i32(),
		stack.pop_f32(),
		stack.pop_f32()
	) {
		(Some(center), Some(num_fingers), Some(delta_dist), Some(delta_angle)) => (center, num_fingers, delta_dist, delta_angle),
		_ => return,
	};
}));
Source

pub const ENTER: &'static str = "Enter"

The Enter slot is triggered when a node is added to the scene graph. Triggers when doing node.add_child().

Source

pub const EXIT: &'static str = "Exit"

The Exit slot is triggered when a node is removed from the scene graph. Triggers when doing node.remove_child().

Source

pub const CLEANUP: &'static str = "Cleanup"

The Cleanup slot is triggered when a node is cleaned up. Triggers only when doing parent.remove_child(node, true).

Source

pub const KEY_DOWN: &'static str = "KeyDown"

The KeyDown slot is triggered when a key is pressed down. Triggers after setting node.set_keyboard_enabled(true).

§Callback Arguments
  • key_name: String - The name of the key that was pressed.
§Callback Example
node.set_keyboard_enabled(true);
node.slot(Slot::KEY_DOWN, Box::new(|stack| {
	let key_name = match stack.pop_str() {
		Some(key_name) => key_name,
		None => return,
	};
	if key_name == KeyName::Space.as_ref() {
		p!("Space key down!");
	}
}));
Source

pub const KEY_UP: &'static str = "KeyUp"

The KeyUp slot is triggered when a key is released. Triggers after setting node.set_keyboard_enabled(true).

§Callback Arguments
  • key_name: String - The name of the key that was released.
§Callback Example
node.set_keyboard_enabled(true);
node.slot(Slot::KEY_UP, Box::new(|stack| {
	let key_name = match stack.pop_str() {
		Some(key_name) => key_name,
		None => return,
	};
	if key_name == KeyName::Space.as_ref() {
		p!("Space key up!");
	}
}));
Source

pub const KEY_PRESSED: &'static str = "KeyPressed"

The KeyPressed slot is triggered when a key is pressed. Triggers after setting node.set_keyboard_enabled(true).

§Callback Arguments
  • key_name: String - The name of the key that was pressed.
§Callback Example
node.set_keyboard_enabled(true);
node.slot(Slot::KEY_PRESSED, Box::new(|stack| {
	let key_name = match stack.pop_str() {
		Some(key_name) => key_name,
		None => return,
	};
	if key_name == KeyName::Space.as_ref() {
		p!("Space key pressed!");
	}
}));
Source

pub const ATTACH_IME: &'static str = "AttachIME"

The AttachIME slot is triggered when the input method editor (IME) is attached (calling node.attach_ime()).

Source

pub const DETACH_IME: &'static str = "DetachIME"

The DetachIME slot is triggered when the input method editor (IME) is detached (calling node.detach_ime() or manually closing IME).

Source

pub const TEXT_INPUT: &'static str = "TextInput"

The TextInput slot is triggered when text input is received. Triggers after calling node.attach_ime().

§Callback Arguments
  • text: String - The text that was input.
§Callback Example
node.attach_ime();
node.slot(Slot::TEXT_INPUT, Box::new(|stack| {
	let text = match stack.pop_str() {
		Some(text) => text,
		None => return,
	};
	p!(text);
}));
Source

pub const TEXT_EDITING: &'static str = "TextEditing"

The TextEditing slot is triggered when text is being edited. Triggers after calling node.attach_ime().

§Callback Arguments
  • text: String - The text that is being edited.
  • start_pos: i32 - The starting position of the text being edited.
§Callback Example
node.attach_ime();
node.slot(Slot::TEXT_EDITING, Box::new(|stack| {
	let (
		text,
		start_pos
	) = match (
		stack.pop_str(),
		stack.pop_i32()
	) {
		(Some(text), Some(start_pos)) => (text, start_pos),
		_ => return,
	};
	p!(text, start_pos);
}));
Source

pub const BUTTON_DOWN: &'static str = "ButtonDown"

The ButtonDown slot is triggered when a game controller button is pressed down. Triggers after setting node.set_controller_enabled(true).

§Callback Arguments
  • controller_id: i32 - The controller id, incrementing from 0 when multiple controllers connected.
  • button_name: String - The name of the button that was pressed.
§Callback Example
node.set_controller_enabled(true);
node.slot(Slot::BUTTON_DOWN, Box::new(|stack| {
	let (
		controller_id,
		button_name
	) = match (
		stack.pop_i32(),
		stack.pop_str()
	) {
		(Some(controller_id), Some(button_name)) => (controller_id, button_name),
		_ => return,
	};
	if controller_id == 0 && button_name == ButtonName::DPUp.as_ref() {
		p!("DPad up button down!");
	}
}));
Source

pub const BUTTON_UP: &'static str = "ButtonUp"

The ButtonUp slot is triggered when a game controller button is released. Triggers after setting node.set_controller_enabled(true).

§Callback Arguments
  • controller_id: i32 - The controller id, incrementing from 0 when multiple controllers connected.
  • button_name: String - The name of the button that was released.
§Callback Example
node.set_controller_enabled(true);
node.slot(Slot::BUTTON_UP, Box::new(|stack| {
	let (
		controller_id,
		button_name
	) = match (
		stack.pop_i32(),
		stack.pop_str()
	) {
		(Some(controller_id), Some(button_name)) => (controller_id, button_name),
		_ => return,
	};
	if controller_id == 0 && button_name == ButtonName::DPUp.as_ref() {
		p!("DPad up button up!");
	}
}));
Source

pub const BUTTON_PRESSED: &'static str = "ButtonPressed"

The ButtonPressed slot is triggered when a game controller button is being pressed. Triggers after setting node.set_controller_enabled(true). This slot is triggered every frame while the button is being pressed.

§Callback Arguments
  • controller_id: i32 - The controller id, incrementing from 0 when multiple controllers connected.
  • button_name: String - The name of the button that is being pressed.
§Callback Example
node.set_controller_enabled(true);
node.slot(Slot::BUTTON_PRESSED, Box::new(|stack| {
	let (
		controller_id,
		button_name
	) = match (
		stack.pop_i32(),
		stack.pop_str()
	) {
		(Some(controller_id), Some(button_name)) => (controller_id, button_name),
		_ => return,
	};
	if controller_id == 0 && button_name == ButtonName::DPUp.as_ref() {
		p!("DPad up button pressed!");
	}
}));
Source

pub const AXIS: &'static str = "Axis"

The Axis slot is triggered when a game controller axis changed. Triggers after setting node.set_controller_enabled(true).

§Callback Arguments
  • controllerId: i32 - The controller id, incrementing from 0 when multiple controllers connected.
  • axis_name: String - The name of the axis that changed.
  • axis_value: f32 - The controller axis value ranging from -1.0 to 1.0.
§Callback Example
node.set_controller_enabled(true);
node.slot(Slot::AXIS, Box::new(|stack| {
	let (
		controller_id,
		axis_name,
		axis_value
	) = match (
		stack.pop_i32(),
		stack.pop_str(),
		stack.pop_f32()
	) {
		(Some(controller_id), Some(axis_name), Some(axis_value)) => (controller_id, axis_name, axis_value),
		_ => return,
	};
	if controller_id == 0 && axis_name == AxisName::LeftX.as_ref() {
		p!("Left stick x value {}", axis_value);
	}
}));
Source

pub const ANIMATION_END: &'static str = "AnimationEnd"

Triggers after an animation has ended on a Playable instance.

§Callback Arguments
  • animation_name: String - The name of the animation that ended.
  • target: Playable - The Playable instance that the animation was played on.
§Callback Example
playable.play("Walk", false);
playable.slot(Slot::ANIMATION_END, Box::new(|stack| {
	let (
		animation_name,
		playable
	) = match (
		stack.pop_str(),
		stack.pop_into_playable()
	) {
		(Some(animation_name), Some(playable)) => (animation_name, playable),
		_ => return,
	};
	if animation_name == "Walk" {
		playable.play("Idle", true);
	}
}));
Source

pub const BODY_ENTER: &'static str = "BodyEnter"

Triggers when a Body object collides with a sensor object. Triggers when Body was attached with sensors.

§Callback Arguments
  • other: Body - The other Body object that the current Body is colliding with.
  • sensorTag: i32 - The tag of the sensor that triggered this collision.
§Callback Example
body.slot(Slot::BODY_ENTER, Box::new(|stack| {
	let (
		other,
		sensor_tag
	) = match (
		stack.pop_into_body(),
		stack.pop_i32()
	) {
		(Some(other), Some(sensor_tag)) => (other, sensor_tag),
		_ => return,
	};
	p!(sensor_tag);
}));
Source

pub const BODY_LEAVE: &'static str = "BodyLeave"

Triggers when a Body object is no longer colliding with a sensor object. Triggers when Body was attached with sensors.

§Callback Arguments
  • other: Body - The other Body object that the current Body is no longer colliding with.
  • sensor_tag: i32 - The tag of the sensor that triggered this collision.
§Callback Example
body.slot(Slot::BODY_LEAVE, Box::new(|stack| {
	let (
		other,
		sensor_tag
	) = match (
		stack.pop_into_body(),
		stack.pop_i32()
	) {
		(Some(other), Some(sensor_tag)) => (other, sensor_tag),
		_ => return,
	};
	p!(sensor_tag);
}));
Source

pub const CONTACT_START: &'static str = "ContactStart"

Triggers when a Body object starts to collide with another object. Triggers after setting body.set_receiving_contact(true).

§Callback Arguments
  • other: Body - The other Body object that the current Body is colliding with.
  • point: Vec2 - The point of collision in world coordinates.
  • normal: Vec2 - The normal vector of the contact surface in world coordinates.
  • enabled: bool - Whether the contact is enabled or not. Collisions that are filtered out will still trigger this event, but the enabled state will be false.
§Callback Example
body.set_receiving_contact(true);
body.slot(Slot::CONTACT_START, Box::new(|stack| {
	let (
		other,
		point,
		normal,
		enabled
	) = match (
		stack.pop_into_body(),
		stack.pop_vec2(),
		stack.pop_vec2(),
		stack.pop_bool()
	) {
		(Some(other), Some(point), Some(normal), Some(enabled)) => (other, point, normal, enabled),
		_ => return,
	};
}));
Source

pub const CONTACT_END: &'static str = "ContactEnd"

Triggers when a Body object stops colliding with another object. Triggers after setting body.set_receiving_contact(true).

§Callback Arguments
  • other: Body - The other Body object that the current Body is no longer colliding with.
  • point: Vec2 - The point of collision in world coordinates.
  • normal: Vec2 - The normal vector of the contact surface in world coordinates.
§Callback Example
body.set_receiving_contact(true);
body.slot(Slot::CONTACT_END, Box::new(|stack| {
	let (
		other,
		point,
		normal
	) = match (
		stack.pop_into_body(),
		stack.pop_vec2(),
		stack.pop_vec2()
	) {
		(Some(other), Some(point), Some(normal)) => (other, point, normal),
		_ => return,
	};
}));
Source

pub const FINISHED: &'static str = "Finished"

Triggered after a Particle node started a stop action and then all the active particles end their lives.

Source

pub const ALIGN_LAYOUT: &'static str = "AlignLayout"

Triggers when the layout of the AlignNode is updated.

§Callback Arguments
  • width: f32 - The width of the AlignNode.
  • height: f32 - The height of the AlignNode.
§Callback Example
align_node.slot(Slot::ALIGN_LAYOUT, Box::new(|stack| {
	let (
		width,
		height
	) = match (
		stack.pop_f32(),
		stack.pop_f32()
	) {
		(Some(width), Some(height)) => (width, height),
		_ => return,
	};
	p!("width: {}, height: {}", width, height);
}));
Source

pub const EFFEK_END: &'static str = "EffekEnd"

Triggers when the EffekseerNode finishes playing an effect.

§Callback Arguments
  • handle: i32 - The handle of the effect that finished playing.
§Callback Example
effekseer_node.slot(Slot::EFFEK_END, Box::new(|stack| {
	let handle = match stack.pop_i32() {
		Some(handle) => handle,
		None => return,
	};
	p!("Effect handle: {}", handle);
}));
Source

pub fn on_action_end<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Action, Node) + 'static,

Registers a callback for event triggered when an action is finished.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • action: Action - The finished action.
    • target: Node - The node that finished the action.
Source

pub fn on_tap_filter<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Touch) + 'static,

Registers a callback for event triggered when a tap is detected and can be used to filter out certain taps.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • touch: Touch - The touch that triggered the tap.
Source

pub fn on_tap_began<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Touch) + 'static,

Registers a callback for event triggered when a tap is detected.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • touch: Touch - The touch that triggered the tap.
Source

pub fn on_tap_ended<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Touch) + 'static,

Registers a callback for event triggered when a tap ends.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • touch: Touch - The touch that triggered the tap.
Source

pub fn on_tapped<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Touch) + 'static,

Registers a callback for event triggered when a tap is detected and has ended.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • touch: Touch - The touch that triggered the tap.
Source

pub fn on_tap_moved<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Touch) + 'static,

Registers a callback for event triggered when a tap moves.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • touch: Touch - The touch that triggered the tap.
Source

pub fn on_mouse_wheel<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Vec2) + 'static,

Registers a callback for event triggered when the mouse wheel is scrolled.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • delta: Vec2 - The amount of scrolling that occurred.
Source

pub fn on_gesture<F>(node: &mut dyn INode, callback: F)
where F: FnMut(Vec2, i32, f32, f32) + 'static,

Registers a callback for event triggered when a multi-touch gesture is recognized.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • center: Vec2 - The center of the gesture.
    • num_fingers: i32 - The number of fingers involved in the gesture.
    • delta_dist: f32 - The distance the gesture has moved.
    • delta_angle: f32 - The angle of the gesture.
Source

pub fn on_enter<F>(node: &mut dyn INode, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when a node is added to the scene graph.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered.
Source

pub fn on_exit<F>(node: &mut dyn INode, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when a node is removed from the scene graph.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered.
Source

pub fn on_cleanup<F>(node: &mut dyn INode, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when a node is cleaned up.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered.
Source

pub fn on_key_down<F>(node: &mut dyn INode, key: KeyName, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when a key is pressed down.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • key: KeyName - The key to trigger the callback on.
  • callback: F - The callback to be called when the event is triggered.
Source

pub fn on_key_up<F>(node: &mut dyn INode, key: KeyName, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when a key is released.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • key: KeyName - The key to trigger the callback on.
Source

pub fn on_key_pressed<F>(node: &mut dyn INode, key: KeyName, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when a key is pressed.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • key: KeyName - The key to trigger the callback on.
Source

pub fn on_attach_ime<F>(node: &mut dyn INode, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when the input method editor (IME) is attached.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered.
Source

pub fn on_detach_ime<F>(node: &mut dyn INode, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when the input method editor (IME) is detached.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered.
Source

pub fn on_text_input<F>(node: &mut dyn INode, callback: F)
where F: FnMut(String) + 'static,

Registers a callback for event triggered when text input is received.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • text: String - The text that was input.
Source

pub fn on_text_editing<F>(node: &mut dyn INode, callback: F)
where F: FnMut(String, i32) + 'static,

Registers a callback for event triggered when text is being edited.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • text: String - The text that is being edited.
    • start_pos: i32 - The starting position of the text being edited.
Source

pub fn on_button_down<F>(node: &mut dyn INode, button: ButtonName, callback: F)
where F: FnMut(i32) + 'static,

Registers a callback for event triggered when a game controller button is pressed down.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • button: ButtonName - The button to trigger the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • controller_id: i32 - The controller id, incrementing from 0 when multiple controllers connected.
Source

pub fn on_button_up<F>(node: &mut dyn INode, button: ButtonName, callback: F)
where F: FnMut(i32) + 'static,

Registers a callback for event triggered when a game controller button is released.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • button: ButtonName - The button to trigger the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • controller_id: i32 - The controller id, incrementing from 0 when multiple controllers connected.
Source

pub fn on_button_pressed<F>( node: &mut dyn INode, button: ButtonName, callback: F, )
where F: FnMut(i32) + 'static,

Registers a callback for event triggered when a game controller button is being pressed. This slot is triggered every frame while the button is being pressed.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • button: ButtonName - The button to trigger the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • controller_id: i32 - The controller id, incrementing from 0 when multiple controllers connected.
Source

pub fn on_axis<F>(node: &mut dyn INode, axis: AxisName, callback: F)
where F: FnMut(i32, f32) + 'static,

Registers a callback for event triggered when a game controller axis changed. This slot is triggered every frame while the axis value changes. The axis value ranges from -1.0 to 1.0.

§Arguments
  • node: &mut dyn INode - The node to register the callback on.
  • axis: AxisName - The axis to trigger the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • controller_id: i32 - The controller id, incrementing from 0 when multiple controllers connected.
Source

pub fn on_animation_end<F>(node: &mut dyn IPlayable, callback: F)
where F: FnMut(String, Playable) + 'static,

Registers a callback for event triggered when an animation has ended on a Playable instance.

§Arguments
  • node: &mut dyn IPlayable - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • animation_name: String - The name of the animation that ended.
    • target: Playable - The Playable instance that the animation was played on.
Source

pub fn on_body_enter<F>(node: &mut dyn IBody, callback: F)
where F: FnMut(Body, i32) + 'static,

Registers a callback for event triggered when a Body object collides with a sensor object.

§Arguments
  • node: &mut dyn IBody - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • other: Body - The other Body object that the current Body is colliding with.
    • sensor_tag: i32 - The tag of the sensor that triggered this collision.
Source

pub fn on_body_leave<F>(node: &mut dyn IBody, callback: F)
where F: FnMut(Body, i32) + 'static,

Registers a callback for event triggered when a Body object is no longer colliding with a sensor object.

§Arguments
  • node: &mut dyn IBody - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • other: Body - The other Body object that the current Body is no longer colliding with.
    • sensor_tag: i32 - The tag of the sensor that triggered this collision.
Source

pub fn on_contact_start<F>(node: &mut dyn IBody, callback: F)
where F: FnMut(Body, Vec2, Vec2, bool) + 'static,

Registers a callback for event triggered when a Body object starts to collide with another object.

§Arguments
  • node: &mut dyn IBody - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • other: Body - The other Body object that the current Body is colliding with.
    • point: Vec2 - The point of collision in world coordinates.
    • normal: Vec2 - The normal vector of the contact surface in world coordinates.
    • enabled: bool - Whether the contact is enabled or not. Collisions that are filtered out will still trigger this event, but the enabled state will be false.
Source

pub fn on_contact_end<F>(node: &mut dyn IBody, callback: F)
where F: FnMut(Body, Vec2, Vec2) + 'static,

Registers a callback for event triggered when a Body object stops colliding with another object.

§Arguments
  • node: &mut dyn IBody - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • other: Body - The other Body object that the current Body is no longer colliding with.
    • point: Vec2 - The point of collision in world coordinates.
    • normal: Vec2 - The normal vector of the contact surface in world coordinates.
Source

pub fn on_finished<F>(node: &mut Particle, callback: F)
where F: FnMut() + 'static,

Registers a callback for event triggered when a Particle node starts a stop action and then all the active particles end their lives.

§Arguments
  • node: &mut Particle - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered.
Source

pub fn on_align_layout<F>(node: &mut AlignNode, callback: F)
where F: FnMut(f32, f32) + 'static,

Registers a callback for event triggered when the layout of the AlignNode is updated.

§Arguments
  • node: &mut AlignNode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • width: f32 - The width of the AlignNode.
    • height: f32 - The height of the AlignNode.
Source

pub fn on_effek_end<F>(node: &mut EffekNode, callback: F)
where F: FnMut(i32) + 'static,

Registers a callback for event triggered when the EffekseerNode finishes playing an effect.

§Arguments
  • node: &mut EffekNode - The node to register the callback on.
  • callback: F - The callback to be called when the event is triggered with the following arguments:
    • handle: i32 - The handle of the effect that finished playing.

Auto Trait Implementations§

§

impl Freeze for Slot

§

impl RefUnwindSafe for Slot

§

impl Send for Slot

§

impl Sync for Slot

§

impl Unpin for Slot

§

impl UnwindSafe for Slot

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.