pub struct Slot {}Expand description
An interface for providing Dora SSR built-in node event names.
Implementations§
Source§impl Slot
impl Slot
Sourcepub const ACTION_END: &'static str = "Action"
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,
};
}));Sourcepub const TAP_FILTER: &'static str = "TapFilter"
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);
}));Sourcepub const TAP_BEGAN: &'static str = "TapBegan"
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,
};
}));Sourcepub const TAP_ENDED: &'static str = "TapEnded"
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,
};
}));Sourcepub const TAPPED: &'static str = "Tapped"
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,
};
}));Sourcepub const TAP_MOVED: &'static str = "TapMoved"
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,
};
}));Sourcepub const MOUSE_WHEEL: &'static str = "MouseWheel"
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,
};
}));Sourcepub const GESTURE: &'static str = "Gesture"
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,
};
}));Sourcepub const ENTER: &'static str = "Enter"
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().
Sourcepub const EXIT: &'static str = "Exit"
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().
Sourcepub const CLEANUP: &'static str = "Cleanup"
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).
Sourcepub const KEY_DOWN: &'static str = "KeyDown"
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!");
}
}));Sourcepub const KEY_UP: &'static str = "KeyUp"
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!");
}
}));Sourcepub const KEY_PRESSED: &'static str = "KeyPressed"
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!");
}
}));Sourcepub const ATTACH_IME: &'static str = "AttachIME"
pub const ATTACH_IME: &'static str = "AttachIME"
The AttachIME slot is triggered when the input method editor (IME) is attached (calling node.attach_ime()).
Sourcepub const DETACH_IME: &'static str = "DetachIME"
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).
Sourcepub const TEXT_INPUT: &'static str = "TextInput"
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);
}));Sourcepub const TEXT_EDITING: &'static str = "TextEditing"
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);
}));Sourcepub const BUTTON_DOWN: &'static str = "ButtonDown"
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!");
}
}));Sourcepub const BUTTON_UP: &'static str = "ButtonUp"
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!");
}
}));Sourcepub const BUTTON_PRESSED: &'static str = "ButtonPressed"
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!");
}
}));Sourcepub const AXIS: &'static str = "Axis"
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);
}
}));Sourcepub const ANIMATION_END: &'static str = "AnimationEnd"
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);
}
}));Sourcepub const BODY_ENTER: &'static str = "BodyEnter"
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);
}));Sourcepub const BODY_LEAVE: &'static str = "BodyLeave"
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
Bodyobject that the currentBodyis 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);
}));Sourcepub const CONTACT_START: &'static str = "ContactStart"
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
Bodyobject that the currentBodyis 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,
};
}));Sourcepub const CONTACT_END: &'static str = "ContactEnd"
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
Bodyobject that the currentBodyis 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,
};
}));Sourcepub const FINISHED: &'static str = "Finished"
pub const FINISHED: &'static str = "Finished"
Triggered after a Particle node started a stop action and then all the active particles end their lives.
Sourcepub const ALIGN_LAYOUT: &'static str = "AlignLayout"
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);
}));Sourcepub const EFFEK_END: &'static str = "EffekEnd"
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);
}));Sourcepub fn on_action_end<F>(node: &mut dyn INode, callback: F)
pub fn on_action_end<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_tap_filter<F>(node: &mut dyn INode, callback: F)
pub fn on_tap_filter<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_tap_began<F>(node: &mut dyn INode, callback: F)
pub fn on_tap_began<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_tap_ended<F>(node: &mut dyn INode, callback: F)
pub fn on_tap_ended<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_tapped<F>(node: &mut dyn INode, callback: F)
pub fn on_tapped<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_tap_moved<F>(node: &mut dyn INode, callback: F)
pub fn on_tap_moved<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_mouse_wheel<F>(node: &mut dyn INode, callback: F)
pub fn on_mouse_wheel<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_gesture<F>(node: &mut dyn INode, callback: F)
pub fn on_gesture<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_enter<F>(node: &mut dyn INode, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_exit<F>(node: &mut dyn INode, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_cleanup<F>(node: &mut dyn INode, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_key_down<F>(node: &mut dyn INode, key: KeyName, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_key_up<F>(node: &mut dyn INode, key: KeyName, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_key_pressed<F>(node: &mut dyn INode, key: KeyName, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_attach_ime<F>(node: &mut dyn INode, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_detach_ime<F>(node: &mut dyn INode, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_text_input<F>(node: &mut dyn INode, callback: F)
pub fn on_text_input<F>(node: &mut dyn INode, callback: F)
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.
Sourcepub fn on_text_editing<F>(node: &mut dyn INode, callback: F)
pub fn on_text_editing<F>(node: &mut dyn INode, callback: F)
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.
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.
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.
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.
Sourcepub fn on_axis<F>(node: &mut dyn INode, axis: AxisName, callback: F)
pub fn on_axis<F>(node: &mut dyn INode, axis: AxisName, callback: F)
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.
Sourcepub fn on_animation_end<F>(node: &mut dyn IPlayable, callback: F)
pub fn on_animation_end<F>(node: &mut dyn IPlayable, callback: F)
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.
Sourcepub fn on_body_enter<F>(node: &mut dyn IBody, callback: F)
pub fn on_body_enter<F>(node: &mut dyn IBody, callback: F)
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.
Sourcepub fn on_body_leave<F>(node: &mut dyn IBody, callback: F)
pub fn on_body_leave<F>(node: &mut dyn IBody, callback: F)
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.
Sourcepub fn on_contact_start<F>(node: &mut dyn IBody, callback: F)
pub fn on_contact_start<F>(node: &mut dyn IBody, callback: F)
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.
Sourcepub fn on_contact_end<F>(node: &mut dyn IBody, callback: F)
pub fn on_contact_end<F>(node: &mut dyn IBody, callback: F)
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.
Sourcepub fn on_finished<F>(node: &mut Particle, callback: F)where
F: FnMut() + 'static,
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.
Sourcepub fn on_align_layout<F>(node: &mut AlignNode, callback: F)
pub fn on_align_layout<F>(node: &mut AlignNode, callback: F)
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.
Sourcepub fn on_effek_end<F>(node: &mut EffekNode, callback: F)
pub fn on_effek_end<F>(node: &mut EffekNode, callback: F)
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.