Photon Quantum 3.0.0

Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
Quantum.Button Struct Reference

The Quantum button used for player input. Instead of using bools or similar data types to represent key presses, the Button type is used inside the Input DSL definition. This is because it only uses one bit per instance, so it is favorable to use where possible. Although they only use one bit over the network, locally they will contain a bit more game state. This is because the single bit is only representative of whether or not the button was pressed during the current frame, the rest of the information is computed locally. More...

Public Member Functions

override int GetHashCode ()
 Overrides the default hash function. More...
 
override string ToString ()
 Converts the numeric value of this instance to its equivalent string representation. More...
 
Button Update (Int32 frame, Boolean state)
 Updates the button state. This is called from the code-generated Quantum input methods. More...
 

Static Public Member Functions

static implicit operator Boolean (Button k)
 Casts a button to Button.IsDown. More...
 
static implicit operator Button (Boolean k)
 Creates a button from the boolean value. More...
 
static void Serialize (Button *ptr, FrameSerializer serializer)
 Serializes a Button into a FrameSerializer to write or read from a frame snapshot. More...
 

Static Public Attributes

const int SIZE = 12
 The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed. More...
 

Properties

Boolean IsDown [get]
 Is the button currently down. More...
 
Boolean WasPressed [get]
 Was the button pressed this frame. More...
 
Boolean WasReleased [get]
 Was the button released this frame. More...
 

Detailed Description

The Quantum button used for player input. Instead of using bools or similar data types to represent key presses, the Button type is used inside the Input DSL definition. This is because it only uses one bit per instance, so it is favorable to use where possible. Although they only use one bit over the network, locally they will contain a bit more game state. This is because the single bit is only representative of whether or not the button was pressed during the current frame, the rest of the information is computed locally.

Member Function Documentation

◆ Update()

Button Quantum.Button.Update ( Int32  frame,
Boolean  state 
)
inline

Updates the button state. This is called from the code-generated Quantum input methods.

Parameters
frameNew frame
stateNew button state
Returns
The updated button.

◆ operator Boolean()

static implicit Quantum.Button.operator Boolean ( Button  k)
inlinestatic

Casts a button to Button.IsDown.

Parameters
kButton to check

◆ operator Button()

static implicit Quantum.Button.operator Button ( Boolean  k)
inlinestatic

Creates a button from the boolean value.

Parameters
kCreates configured button representing a recently pressed button

◆ Serialize()

static void Quantum.Button.Serialize ( Button ptr,
FrameSerializer  serializer 
)
inlinestatic

Serializes a Button into a FrameSerializer to write or read from a frame snapshot.

Parameters
ptrThe pointer to the Button.
serializerThe FrameSerializer instance into which the struct will be serialized.

◆ ToString()

override string Quantum.Button.ToString ( )
inline

Converts the numeric value of this instance to its equivalent string representation.

Returns
The string representation of the value of this instance

◆ GetHashCode()

override int Quantum.Button.GetHashCode ( )
inline

Overrides the default hash function.

Returns
A hash code for the current object.

Member Data Documentation

◆ SIZE

const int Quantum.Button.SIZE = 12
static

The size of the component (or struct/type) in-memory inside the Frame data-buffers or stack (when passed as value parameter). Not related to the snapshot payload this occupies, which is bit-packed and compressed.

Property Documentation

◆ IsDown

Boolean Quantum.Button.IsDown
get

Is the button currently down.

◆ WasPressed

Boolean Quantum.Button.WasPressed
get

Was the button pressed this frame.

◆ WasReleased

Boolean Quantum.Button.WasReleased
get

Was the button released this frame.