ProtoFlux:Button Events: Difference between revisions

From Resonite Wiki
m forgot it in page description
Added some spaces.
 
(8 intermediate revisions by 4 users not shown)
Line 4: Line 4:
|Outputs=
|Outputs=
[
[
{"Name":"Pressed", "Type":"Impulse"},
{"Name":"Pressed", "Type":"Call"},
{"Name":"Pressing", "Type":"Impulse"},
{"Name":"Pressing", "Type":"Call"},
{"Name":"Released", "Type":"Impulse"},
{"Name":"Released", "Type":"Call"},
{"Name":"HoverEnter", "Type":"Impulse"},
{"Name":"HoverEnter", "Type":"Call"},
{"Name":"HoverStay", "Type":"Impulse"},
{"Name":"HoverStay", "Type":"Call"},
{"Name":"HoverLeave", "Type":"Impulse"},
{"Name":"HoverLeave", "Type":"Call"},
{"Name":"Source", "Type":"Component"},
{"Name":"Source", "Type":"Component"},
{"Name":"GlobalPoint", "Type":"float3"},
{"Name":"GlobalPoint", "Type":"float3"},
Line 21: Line 21:
|}}
|}}


The <code>Button Events</code> node takes in a global [[Type:IButton|IButton]] reference and will listen for events from that global reference. When it detects something happening, it will fire events depending on what happens, along with other data.


== Inputs == <!--T:3-->
You can use this node with [[Component:Button|UI Buttons]], [[Component:TouchButton|Touch Buttons]], [[Component:PhysicalButton|Physical Buttons]], [[Context menu|Context Menu]] Buttons, or even a custom button you add as a component onto a [[Slot]] or object, like a box.
 
=== Button (IButton)[Global] ===
[[IButton]] to read events from.


== Outputs == <!--T:3-->
== Outputs == <!--T:3-->


=== Pressed (Impulse) ===
=== Pressed ([[Impulses|Call]]) ===
Sends an Impulse when the button in Global: IButton is pressed down
Sends an Impulse when the button in Global: IButton is pressed down


=== Pressing (Impulse) ===
=== Pressing ([[Impulses|Call]]) ===
Sends an Impulse every game update while the button in Global: IButton is being held down
Sends an Impulse every game update while the button in Global: IButton is being held down


=== Released (Impulse) ===
=== Released ([[Impulses|Call]]) ===
Sends an Impulse when the button in Global: IButton is released
Sends an Impulse when the button in Global: IButton is released


=== HoverEnter (Impulse) ===
=== HoverEnter ([[Impulses|Call]]) ===
Sends an Impulse a cursor/laser is brought on top of the button in Global: IButton (TODO: Does this include touching? (Ex: Physical buttons))
Sends an Impulse a cursor/laser is brought on top of the button in Global: IButton (TODO: Does this include touching? (Ex: Physical buttons))


=== HoverStay (Impulse) ===
=== HoverStay ([[Impulses|Call]]) ===
Sends an Impulse every game update while the button in Global: IButton is being currently being hovered over (TODO: Does this include touching? (Ex: Physical buttons))
Sends an Impulse every game update while the button in Global: IButton is being currently being hovered over (TODO: Does this include touching? (Ex: Physical buttons))


=== HoverLeave (Impulse) ===
=== HoverLeave ([[Impulses|Call]]) ===
Sends an Impulse a cursor/laser leaves being on top of the button in Global: IButton (TODO: Does this include touching? (Ex: Physical buttons))
Sends an Impulse a cursor/laser leaves being on top of the button in Global: IButton (TODO: Does this include touching? (Ex: Physical buttons))


=== Source (Component) ===
=== Source ([[Component]]) ===
The source of the button press (TODO: Is this a interaction laser and/or tip touch source?)
The source of the button press.
 
When using the laser on the button, this returns with <code>RelayTouchSource</code>.
 
When physically pressing the button, this returns with <code>TipTouchSource</code>.


=== GlobalPoint (float3) ===
=== GlobalPoint ([[Type:Float3|float3]]) ===
The point in global transform in the world the user's cursor is at on the surface of the button during any of this node's Impulses
The point in global transform in the world the user's cursor is at on the surface of the button during any of this node's Impulses
Example: Useful for a splash of particles where the user clicked like a click effect
Example: Useful for a splash of particles where the user clicked like a click effect
Also see: [[Coordinate spaces]]
Also see: [[Coordinate spaces]]


=== LocalPoint(float3) ===
=== LocalPoint ([[Type:Float3|float3]]) ===
The point in UIX pixels within the button's local [[RectTransform (Component)|RectTransform]] the user's cursor is at during any of this node's Impulses
The point in UIX pixels within the button's local [[RectTransform (Component)|RectTransform]] the user's cursor is at during any of this node's Impulses
Also see: [[Coordinate spaces]]
Also see: [[Coordinate spaces]]


=== NormalizedPoint(float2) ===
=== NormalizedPoint ([[Type:Float2|float2]]) ===
The point from 0 to 1 in both the x and y channels within the button's local [[RectTransform (Component)|RectTransform]] the user's cursor is at during any of this node's Impulses.
The point from 0 to 1 in both the x and y channels within the button's local [[RectTransform (Component)|RectTransform]] the user's cursor is at during any of this node's Impulses.
Also see: [[Coordinate spaces]]
Also see: [[Coordinate spaces]]
== Globals ==
=== Button ([[Type:IButton|IButton]]) ===
[[Type:IButton|IButton]] to read events from.
== Examples ==
<gallery widths=480px heights=480px>
File:ProtoFlux_example_button_events|Button Events being used to make a sound play.
</gallery>


[[Category:ProtoFlux:Interaction]]
[[Category:ProtoFlux:Interaction]]

Latest revision as of 04:21, 21 May 2024

Button Events
Pressed
Pressing
Released
HoverEnter
HoverStay
HoverLeave
Source
GlobalPoint
LocalPoint
NormalizedPoint
Button
null
Interactions

The Button Events node takes in a global IButton reference and will listen for events from that global reference. When it detects something happening, it will fire events depending on what happens, along with other data.

You can use this node with UI Buttons, Touch Buttons, Physical Buttons, Context Menu Buttons, or even a custom button you add as a component onto a Slot or object, like a box.

Outputs

Pressed (Call)

Sends an Impulse when the button in Global: IButton is pressed down

Pressing (Call)

Sends an Impulse every game update while the button in Global: IButton is being held down

Released (Call)

Sends an Impulse when the button in Global: IButton is released

HoverEnter (Call)

Sends an Impulse a cursor/laser is brought on top of the button in Global: IButton (TODO: Does this include touching? (Ex: Physical buttons))

HoverStay (Call)

Sends an Impulse every game update while the button in Global: IButton is being currently being hovered over (TODO: Does this include touching? (Ex: Physical buttons))

HoverLeave (Call)

Sends an Impulse a cursor/laser leaves being on top of the button in Global: IButton (TODO: Does this include touching? (Ex: Physical buttons))

Source (Component)

The source of the button press.

When using the laser on the button, this returns with RelayTouchSource.

When physically pressing the button, this returns with TipTouchSource.

GlobalPoint (float3)

The point in global transform in the world the user's cursor is at on the surface of the button during any of this node's Impulses Example: Useful for a splash of particles where the user clicked like a click effect Also see: Coordinate spaces

LocalPoint (float3)

The point in UIX pixels within the button's local RectTransform the user's cursor is at during any of this node's Impulses Also see: Coordinate spaces

NormalizedPoint (float2)

The point from 0 to 1 in both the x and y channels within the button's local RectTransform the user's cursor is at during any of this node's Impulses. Also see: Coordinate spaces

Globals

Button (IButton)

IButton to read events from.

Examples