SDK 6.3/PAWN/Topology
SDK 6.3 · PAWN API: Core ·
Graphics ·
Topology ·
Sound ·
Motion Sensor ·
Leaderboard ·
Splash Screen ·
Physics ·
Network ·
Save ·
Scramble ·
Logging
C++: Native API · Application · GFX Engine · Rust: Rust API (experimental) · Changelog
← SDK 6.3 · PAWN / Topology
Enumerations
TOPOLOGY_neighbor
Syntax:
const TOPOLOGY_neighbor: {
NEIGHBOR_SELF = 0,
NEIGHBOR_LEFT,
NEIGHBOR_DIAGONAL,
NEIGHBOR_TOP,
NEIGHBOR_RIGHT,
NEIGHBOR_BOTTOM,
NEIGHBOR_MAX,
};
Description:
- Enumeration of a facelet neighbor directions.
TOPOLOGY_orientation
Syntax:
const TOPOLOGY_orientation: {
ORIENTATION_UP = 0,
ORIENTATION_DOWN,
ORIENTATION_FRONT,
ORIENTATION_BACK,
ORIENTATION_LEFT,
ORIENTATION_RIGHT,
ORIENTATION_MAX,
};
Description:
- Enumeration of a face orientations.
History:
- v5.0 - renamed from TOPOLOGY_location to the TOPOLOGY_orientation
TOPOLOGY_orientation_mode
Syntax:
const TOPOLOGY_orientation_mode: {
ORIENTATION_MODE_MENU = 0,
ORIENTATION_MODE_GRAVITY,
ORIENTATION_MODE_SPLASH,
ORIENTATION_MODE_MAX,
};
Description:
- Enumeration of an orientation modes.
History:
- v5.0 - renamed from TOPOLOGY_orientation to TOPOLOGY_orientation_mode
TOPOLOGY_twist
Syntax:
const TOPOLOGY_twist: {
TWIST_UNINDENTIFIED = 0,
TWIST_LEFT,
TWIST_RIGHT,
TWIST_DOUBLE,
TWIST_MAX,
};
Description:
- Enumeration of twist directions.
TOPOLOGY_reverseFaces
Syntax:
stock const TOPOLOGY_reverseFaces { TOPOLOGY_FACES_MAX } = { 3, 5, 4, 0, 2, 1 };
Description:
- Array with opposite cube faces.
- Value at a face position corresponds its opposite face, e.g. face opposite
- to 0 is 3 and vice versa.
Constants and defines
TOPOLOGY_FACES_MAX
Syntax:
#define TOPOLOGY_FACES_MAX 6
Description:
- How many faces the cube has.
TOPOLOGY_POSITIONS_MAX
Syntax:
#define TOPOLOGY_POSITIONS_MAX 4
Description:
- How many screens there are on a single cube face.
Data structures
TOPOLOGY_FACELET
Syntax:
#define TOPOLOGY_FACELET [ .module, .screen ]
Description:
- Array with named fields which represents a single facelet.
- Fields:
- module - an ID of the module on which facelet is located
- screen - a number of the module screen which corresponds to the facelet
See also: TOPOLOGY_FACELET_INFO, TOPOLOGY_getAdjacentFacelet(), TOPOLOGY_getPlace(), TOPOLOGY_getOppositeFacelet(), TOPOLOGY_getAngle(), TOPOLOGY_getFaceletOrientation()
TOPOLOGY_FACELET_INFO
Syntax:
#define TOPOLOGY_FACELET_INFO [ TOPOLOGY_FACELET, .connected ]
Description:
- Array with named fields with meta information about a single facelet.
- Fields:
- module - an ID of the module on which the facelet is located
- screen - a number of the module screen which corresponds to the facelet
- connected - connection status, depends on the context
See also: TOPOLOGY_FACELET, TOPOLOGY_getFacelet(), TOPOLOGY_getAdjacentFacelet(), TOPOLOGY_getOppositeFacelet()
TOPOLOGY_PLACE
Syntax:
#define TOPOLOGY_PLACE [ .face, .position ]
Description:
- Array with named fields which represents screens place on the cube surface.
- Fields:
- face - a face number on which screen is located
- position - a position on the face on which screen is located
See also: TOPOLOGY_getFacelet(), TOPOLOGY_getPlace(), TOPOLOGY_getPlaceOrientation()
TOPOLOGY_TWIST_INFO
Syntax:
#define TOPOLOGY_TWIST_INFO [ .screen, .count, TOPOLOGY_twist: .direction ]
Description:
- Array with named fields with twist parameters.
- Fields:
- screen - a number of the screen around which a twist was detected
- count - how many twists happened from the application start
- direction - a twist direction
See also: TOPOLOGY_twist, ON_Twist()
Event handlers
ON_Twist
Syntax:
forward ON_Twist(twist[TOPOLOGY_TWIST_INFO]);
Description:
- Twist handler.
- Public function with such signature will be called when a cube twist
- detected.
Arguments:
- twist
- a twist description
See also: TOPOLOGY_TWIST_INFO
Functions
TOPOLOGY_getAdjacentFacelet
Syntax:
native TOPOLOGY_getAdjacentFacelet[TOPOLOGY_FACELET_INFO](facelet[TOPOLOGY_FACELET], TOPOLOGY_neighbor: direction = NEIGHBOR_DIAGONAL);
Description:
- Get a facelet neighbor in the given direction.
- Facelet can have neighbors on the same cube face or neighbors by module.
- This function provide a neighbor of the given facelet in the given
- direction. Connection status indicates if there is a connection between
- modules on which given facelet and its neighbor are located.
Arguments:
- facelet
- a facelet which neighbor is requested
- direction
- a direction in which neighbor is requested
Return values:
- Neighbor facelet in a given direction with its connection status. The
- module ID will be MODULES_MAX and the screen number will be SCREENS_MAX in
- case of an error (e.g. incorrect arguments or the topology malfunction).
See also: TOPOLOGY_FACELET, TOPOLOGY_FACELET_INFO, MODULES_MAX, SCREENS_MAX, TOPOLOGY_neighbor
TOPOLOGY_getFacelet
Syntax:
native TOPOLOGY_getFacelet[TOPOLOGY_FACELET_INFO](place[TOPOLOGY_PLACE], TOPOLOGY_orientation_mode: mode = ORIENTATION_MODE_MENU);
Description:
- Get a facelet located in the given place.
Arguments:
- place
- a place on a cube surface which corresponding facelet is
- requested
- mode
- the place position orientation mode
Return values:
- Facelet located in the given place, connection status indicates if there
- any connection to the module on which this facelet resides. The module ID
- will be MODULES_MAX and the screen screen will be SCREENS_MAX in case of an
- error (e.g. incorrect arguments or the topology malfunction).
See also: TOPOLOGY_FACELET, TOPOLOGY_FACELET_INFO, TOPOLOGY_PLACE, MODULES_MAX, SCREENS_MAX, TOPOLOGY_orientation_mode
TOPOLOGY_getPlace
Syntax:
native TOPOLOGY_getPlace[TOPOLOGY_PLACE](facelet[TOPOLOGY_FACELET], TOPOLOGY_orientation_mode: mode = ORIENTATION_MODE_MENU);
Description:
- Get a place of the facelet.
Arguments:
- facelet
- facelet which place on cube surface is requested
- mode
- place position orientation mode
Return values:
- Place on cube surface where the given facelet located. Face will be
- TOPOLOGY_FACES_MAX and position will be TOPOLOGY_POSITIONS_MAX in case of
- an error (e.g. incorrect arguments or topology malfunction)
See also: TOPOLOGY_FACELET, TOPOLOGY_PLACE, TOPOLOGY_FACES_MAX, TOPOLOGY_POSITIONS_MAX, TOPOLOGY_orientation_mode
TOPOLOGY_getOppositeFacelet
Syntax:
native TOPOLOGY_getOppositeFacelet[TOPOLOGY_FACELET_INFO](facelet[TOPOLOGY_FACELET]);
Description:
- Get an opposite facelet located on a diagonal counterpart module.
Arguments:
- facelet
- a facelet for which opposite diagonal counterpart is requested
Return values:
- Diagonal opposite counterpart facelet. Connection status indicates if there
- any connection to the module on which that facelet resides. The module ID
- will be MODULES_MAX and the screen number will be SCREENS_MAX in case of an
- error (e.g. incorrect arguments or topology malfunction).
See also: TOPOLOGY_FACELET_INFO, TOPOLOGY_FACELET, MODULES_MAX, SCREENS_MAX
TOPOLOGY_getAngle
Syntax:
native TOPOLOGY_getAngle(facelet[TOPOLOGY_FACELET], TOPOLOGY_orientation_mode: mode = ORIENTATION_MODE_MENU);
Description:
- Get an angle to align images on a face according to the orientation mode.
- Display coordinates system is persistent on a module screen. Different
- angles are needed to align images on all modules with screens on the same
- face. This function returns the angle for the screen specified by the
- facelet. The angle is relative to the position 0 on the same face where the
- facelet is located in the given orientation mode.
Arguments:
- facelet
- a facelet for which screen an angle is requested
- mode
- an orientation mode in which an angle is requested
Return values:
- Angle to align images on the same face according to the orientation mode, 0
- in case of an error (e.g. incorrect arguments or the topology malfunction).
See also: TOPOLOGY_FACELET, TOPOLOGY_orientation_mode, PawnLibs/GFX module
TOPOLOGY_getFaceletOrientation
Syntax:
native TOPOLOGY_orientation: TOPOLOGY_getFaceletOrientation(facelet[TOPOLOGY_FACELET]);
Description:
- Get a face orientation on which the given facelet resides.
Arguments:
- facelet
- a facelet for which the face orientation is requested
Return values:
- Face orientation on which the given facelet resides, ORIENTATION_MAX in
- case of an error (e.g. incorrect arguments or the topology malfunction).
See also: TOPOLOGY_FACELET, TOPOLOGY_orientation
History:
- v5.0 - renamed from TOPOLOGY_getFaceletLocation() to the
- TOPOLOGY_getFaceletOrientation()
TOPOLOGY_getPlaceOrientation
Syntax:
native TOPOLOGY_orientation: TOPOLOGY_getPlaceOrientation(place[TOPOLOGY_PLACE]);
Description:
- Get a face orientation on which the given place resides.
Arguments:
- place
- a place for which the face orientation is requested
Return values:
- Face orientation on which the given place resides, ORIENTATION_MAX in case
- of an error (e.g. incorrect arguments or the topology malfunction).
See also: TOPOLOGY_PLACE, TOPOLOGY_orientation
History:
- v5.0 - renamed from TOPOLOGY_getPlaceLocation() to the
- TOPOLOGY_getPlaceOrientation()
TOPOLOGY_getFace
Syntax:
native TOPOLOGY_getFace(TOPOLOGY_orientation: orientation = ORIENTATION_UP);
Description:
- Get a face number which has the given orientation.
Arguments:
- orientation
- a orientation of the requested face
Return values:
- Face number which has the given orientation, TOPOLOGY_FACES_MAX in case of
- an error (e.g. incorrect arguments or the topology malfunction).
See also: TOPOLOGY_orientation, TOPOLOGY_FACES_MAX
TOPOLOGY_isAssembled
Syntax:
native bool: TOPOLOGY_isAssembled();
Description:
- Check that all modules in a system are connected to each other.
Return values:
- True if all modules in a system are connected to each other, false
- otherwise.