v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | List of all members
Sifteo::Neighborhood Struct Reference

A Neighborhood is a description of all neighbors for a single cube, packed into a small value. More...

#include <sifteo/cube.h>

Public Member Functions

CubeID cubeAt (Side side) const
 Return the neighbor at a particular side, as a CubeID. More...
 
bool hasCubeAt (Side side) const
 Is there a cube at this side? This is equivalent to calling isCube() on the result of neighborAt().
 
bool hasNeighborAt (Side side) const
 Is there a neighbor at this side? This is equivalent to calling !isEmpty() on the result of neighborAt().
 
NeighborID neighborAt (Side side) const
 Return the neighbor at a particular side, as a NeighborID.
 
 Neighborhood ()
 Default constructor. Leaves the Neighborhood uninitialized.
 
 Neighborhood (_SYSNeighborState sys)
 Initialize a Neighborhood from a low-level _SYSNeighborState object.
 
 Neighborhood (CubeID cube)
 Get a Neighborhood representing the physical neighbors for a cube. More...
 
 operator _SYSNeighborState & ()
 Implicit conversion to _SYSNeighborState, for use in low-level system calls.
 
Side sideOf (CubeID cube) const
 Search for a CubeID in this Neighborhood. More...
 

Detailed Description

A Neighborhood is a description of all neighbors for a single cube, packed into a small value.

Each side can be empty, or it can refer to another cube by its CubeID.

Constructor & Destructor Documentation

Sifteo::Neighborhood::Neighborhood ( CubeID  cube)
inline

Get a Neighborhood representing the physical neighbors for a cube.

The sides in this Neighborhood are relative to the physical cube hardware, not to the current screen orientation. (A CubeID object has no way of knowing what the current screen orientation is.)

Member Function Documentation

CubeID Sifteo::Neighborhood::cubeAt ( Side  side) const
inline

Return the neighbor at a particular side, as a CubeID.

If no neighbor exists at that side OR if the neighbor is not a cube, we return an undefined CubeID.

Side Sifteo::Neighborhood::sideOf ( CubeID  cube) const
inline

Search for a CubeID in this Neighborhood.

If the specified cube is part of this neighborhood (i.e. it was neighbored to the cube that this Neighborhood was created for), return the Side where that cube is found. Otherwise, returns NO_SIDE.


The documentation for this struct was generated from the following file: