|
stmm-games-doc
0.32.0
|
Classes | |
| struct | Contact |
| A contact. More... | |
Public Member Functions | |
| Block () noexcept | |
| Empty constructor. More... | |
| Block (int32_t nTotBricks, const std::vector< Tile > &aBrick, int32_t nTotShapes, const std::vector< std::vector< std::tuple< bool, int32_t, int32_t > > > &aShapeBrickPos) noexcept | |
| Constructor. More... | |
| Block (int32_t nTotBricks, const std::vector< Tile > &aBrick, const std::vector< std::tuple< bool, int32_t, int32_t > > &aBrickPos, int32_t nWH) noexcept | |
| Automatically rotated four shapes constructor. More... | |
| Block (int32_t nFirstShapeId, const Block &oFirst, int32_t nSecondShapeId, const Block &oSecond, int32_t nRelX, int32_t nRelY, int32_t &nFirstPosXDelta, int32_t &nFirstPosYDelta, std::unordered_map< int32_t, int32_t > &oFirstBrickIds, std::unordered_map< int32_t, int32_t > &oSecondBrickIds) noexcept | |
| Automatically rotated four shapes constructor fusing two blocks. More... | |
| void | swap (Block &oBlock) noexcept |
| Swap two blocks. More... | |
| Block (const Block &oSource) noexcept | |
| Copy constructor. More... | |
| Block & | operator= (const Block &oSource) noexcept |
| Assignment. More... | |
| bool | isEmpty () const noexcept |
| Whether the block has any bricks. More... | |
| int32_t | totBricks () const noexcept |
| The total number of bricks in the block. More... | |
| int32_t | totShapes () const noexcept |
| The total number of shapes in the block. More... | |
| const std::vector< int32_t > & | brickIds () const noexcept |
| The brick ids of the block. More... | |
| std::vector< int32_t > | shapeIds () const noexcept |
| The shape ids (in ascending order). More... | |
| bool | isBrickId (int32_t nBrickId) const noexcept |
| Whether the brick id is valid. More... | |
| bool | isShapeId (int32_t nShapeId) const noexcept |
| Whether the shape id is valid. More... | |
| const Tile & | brick (int32_t nBrickId) const noexcept |
| The tile of the block's brick. More... | |
| int32_t | shapeBrickPosX (int32_t nShapeId, int32_t nBrickId) const noexcept |
| The x position of a brick in a shape. More... | |
| int32_t | shapeBrickPosY (int32_t nShapeId, int32_t nBrickId) const noexcept |
| The y position of a brick in a shape. More... | |
| NPoint | shapeBrickPos (int32_t nShapeId, int32_t nBrickId) const noexcept |
| The position of a brick in a shape. More... | |
| bool | shapeBrickVisible (int32_t nShapeId, int32_t nBrickId) const noexcept |
| Tells whether a brick is visible in the given shape. More... | |
| int32_t | shapeTotVisibleBricks (int32_t nShapeId) const noexcept |
| Total number of visible bricks of a shape. More... | |
| int32_t | shapeBrickVisiblePosition (int32_t nShapeId, int32_t nX, int32_t nY) const noexcept |
| Tells whether at the given position in the shape there is a visible brick. More... | |
| bool | shapeBrickSetVisible (int32_t nShapeId, int32_t nBrickId, bool bVisible) noexcept |
| Sets the visibility of a brick in a shape. More... | |
| bool | shapeBrickSetPosVisible (int32_t nShapeId, int32_t nBrickId, int32_t nX, int32_t nY, bool bVisible) noexcept |
| Sets the position and visibility of a brick in a shape. More... | |
| bool | shapeModifyBricks (int32_t nShapeId, const std::vector< std::tuple< int32_t, int32_t, int32_t, bool > > &aBrickPosition) noexcept |
| Modifies the given bricks: tuple<nBrickId, nX, nY, bVisible> The positions are set even if couldn't set the visibility of one or more bricks. More... | |
| const std::vector< Contact > | shapeContacts (int32_t nShapeId, Direction::VALUE eDir) const noexcept |
| The contacts for a certain shape and direction. More... | |
| int32_t | brickAdd (const Tile &oTile, int32_t nX, int32_t nY, bool bVisible) noexcept |
| Adds a brick at the given position in each shape. More... | |
| void | brickModify (int32_t nBrickId, const Tile &oTile) noexcept |
| Modify the tile of a brick. More... | |
| void | brickRemove (int32_t nBrickId) noexcept |
| Removes a brick. More... | |
| int32_t | shapeInsert (int32_t nBeforeShapeId) noexcept |
| Inserts a shape into the block. More... | |
| int32_t | shapeInsert (int32_t nBeforeShapeId, int32_t nCopyOfShapeId) noexcept |
| Inserts a copy of another shape into the block. More... | |
| void | shapeRemove (int32_t nShapeId) noexcept |
| Removes a shape. More... | |
| int32_t | shapeRemoveAllInvisible () noexcept |
| Remove all shapes that have no visible bricks. More... | |
| int32_t | shapeFirst () const noexcept |
| The first shape id. More... | |
| int32_t | shapeLast () const noexcept |
| The last shape id. More... | |
| int32_t | shapePrec (int32_t nShapeId) const noexcept |
| The shape id of the shape preceding another. More... | |
| int32_t | shapeNext (int32_t nShapeId) const noexcept |
| The shape id of the shape following another. More... | |
| int32_t | shapeMinX (int32_t nShapeId) const noexcept |
| The minimum x position of the visible bricks in a shape. More... | |
| int32_t | shapeMinY (int32_t nShapeId) const noexcept |
| The minimum y position of the visible bricks in a shape. More... | |
| NPoint | shapeMinPos (int32_t nShapeId) const noexcept |
| The minimum position of the visible bricks in a shape. More... | |
| int32_t | shapeMaxX (int32_t nShapeId) const noexcept |
| The maximum x position of the visible bricks in a shape. More... | |
| int32_t | shapeMaxY (int32_t nShapeId) const noexcept |
| The maximum y position of the visible bricks in a shape. More... | |
| NPoint | shapeMaxPos (int32_t nShapeId) const noexcept |
| The maximum position of the visible bricks in a shape. More... | |
| int32_t | maxWidth () const noexcept |
| The maximum width of all shapes. More... | |
| int32_t | maxHeight () const noexcept |
| The maximum height of all shapes. More... | |
| int32_t | shapeWidth (int32_t nShapeId) const noexcept |
| The width of a given shape. More... | |
| int32_t | shapeHeight (int32_t nShapeId) const noexcept |
| The height of a given shape. More... | |
| NSize | shapeSize (int32_t nShapeId) const noexcept |
| The size of a given shape. More... | |
| int32_t | widestShapeId () const noexcept |
| The widest shape of the block. More... | |
| int32_t | highestShapeId () const noexcept |
| The highest shape of the block. More... | |
| void | dump () const noexcept |
| void | dump (int32_t nIndent) const noexcept |
|
noexcept |
Empty constructor.
Creates a block with no shapes and no bricks.
|
noexcept |
Constructor.
aBrick[0 .. nTotBricks-1]: Tile aShapeBrickPos[0 .. nTotShapes-1][0.. nTotBricks-1]: tuple(bVisible, nPosX, nPosY)
Empty Tiles are not allowed and are replaced with some unusual non-empty tile. Missing tiles (aBrick parameter) also are filled with some non-empty tile. Undefined positions within a shape make bricks invisible.
For each shape a position can only have a visible brick, those in excess are set to not visible.
The created bricks start from id 0 and increment. The created shapes start from id 0 and increment.
| nTotBricks | The number of bricks. Must be > 0. |
| aBrick | The bricks (tiles). |
| nTotShapes | The number of shapes. Must be > 0. |
| aShapeBrickPos | The visibility and position of each brick and shape. |
|
noexcept |
Automatically rotated four shapes constructor.
Block is generated automatically from 1 shape, adding 3 shapes rotated 90, 180, 270 degrees.
aBrick[0 .. nTotBricks-1]: Tile aBrickPos[0 .. nTotBricks-1]: tuple(bVisible, nPosX, nPosY)
Empty Tiles are not allowed and are replaced with some unusual non-empty tile. Missing tiles (aBrick parameter) also are filled with some non-empty tile. Undefined positions within a shape make bricks invisible.
For each shape a position can only have a visible brick, those in excess are set to not visible.
The created bricks start from id 0 and increment. The created shapes start from id 0 and increment.
| nTotBricks | The number of bricks. Must be > 0. |
| aBrick | The bricks (tiles). |
| aBrickPos | The visibility and position of each brick within the first shape. |
| nWH | The value that defines the center of rotation (nWH / 2, nWH / 2). Example: 3 -> (1.5, 1.5). |
|
noexcept |
Automatically rotated four shapes constructor fusing two blocks.
Only the visible bricks of the given shapes are used to build the result block.
Add (nFirstPosXDelta, nFirstPosYDelta) to the position of the first block to get the position of the result block to make it coincide with the fused blocks.
The result Block is generated automatically from the fused shapes, adding 3 additional shapes rotated counterclockwise 90, 180 and 270 degrees around the "geometric" center.
The created bricks start from id 0 and increment. The created shapes start from id 0 and increment.
| nFirstShapeId | The shape of the first block to be used. |
| oFirst | The first block. |
| nSecondShapeId | The shape of the second block to be used. |
| oSecond | The second block. |
| nRelX | The x position of the second block relative to the first. |
| nRelY | The y position of the second block relative to the first. |
| nFirstPosXDelta | The delta x position of the first block to the result block. |
| nFirstPosYDelta | The delta y position of the first block to the result block. |
| oFirstBrickIds | The mapping from the first block's brick ids to the result's brick ids. |
| oSecondBrickIds | The mapping from the second block's brick ids to the result's brick ids. |
|
noexcept |
Copy constructor.
| oSource | The source block. |
|
noexcept |
The tile of the block's brick.
| nBrickId | The brick id. Must be valid. |
|
noexcept |
Adds a brick at the given position in each shape.
If bVisible is true the added brick might still not be visible in a shape because its position is already occupied by another visible brick.
If the block has no shapes, one is created.
If the tile is empty, some non empty tile is used.
| oTile | The tile of the brick. |
| nX | The x coord of the brick. |
| nY | The y coord of the brick. |
| bVisible | Whether the brick is visible. |
|
inlinenoexcept |
The brick ids of the block.
|
noexcept |
Modify the tile of a brick.
If the tile is empty, some non empty tile is used.
| nBrickId | The brick id. |
| oTile | The new tile. |
|
noexcept |
Removes a brick.
| nBrickId | The brick id. |
|
noexcept |
|
noexcept |
|
noexcept |
The highest shape of the block.
|
noexcept |
Whether the brick id is valid.
| nBrickId | The brick id. |
|
inlinenoexcept |
Whether the block has any bricks.
Note: the block with bricks but no shapes is considered non empty.
|
noexcept |
Whether the shape id is valid.
| nShapeId | The shape id. |
|
noexcept |
The maximum height of all shapes.
Returns 0 if no visible bricks or no shapes.
|
noexcept |
The maximum width of all shapes.
Returns 0 if no visible bricks or no shapes.
Assignment.
| oSource | The source block. |
|
noexcept |
The position of a brick in a shape.
| nShapeId | The shape id. Must be valid. |
| nBrickId | The brick id. Must be valid. |
|
noexcept |
The x position of a brick in a shape.
| nShapeId | The shape id. Must be valid. |
| nBrickId | The brick id. Must be valid. |
|
noexcept |
The y position of a brick in a shape.
| nShapeId | The shape id. Must be valid. |
| nBrickId | The brick id. Must be valid. |
|
noexcept |
Sets the position and visibility of a brick in a shape.
The position is set even if couldn't set the visibility.
| nShapeId | The shape id. Must be valid. |
| nBrickId | The brick id. Must be valid. |
| nX | The x position. |
| nY | The y position. |
| bVisible | The visibility. |
|
noexcept |
Sets the visibility of a brick in a shape.
| nShapeId | The shape id. Must be valid. |
| nBrickId | The brick id. Must be valid. |
| bVisible | The visibility. |
|
noexcept |
Tells whether a brick is visible in the given shape.
| nShapeId | The shape id. Must be valid. |
| nBrickId | The brick id. Must be valid. |
|
noexcept |
Tells whether at the given position in the shape there is a visible brick.
| nShapeId | The shape id. Must be valid. |
| nX | The x position. |
| nY | The y position. |
|
noexcept |
The contacts for a certain shape and direction.
| nShapeId | The shape id. Must be valid. |
| eDir | The direction. |
|
noexcept |
The first shape id.
Is (sort of) same as shapeIds()[0], but more efficient.
|
noexcept |
The height of a given shape.
| nShapeId | The shape id. |
|
inlinenoexcept |
The shape ids (in ascending order).
|
noexcept |
Inserts a shape into the block.
If nBeforeShapeId is -1 added as last shape.
All bricks will be set at position (0,0) and be not visible.
| nBeforeShapeId | The shape id before which the shape must be inserted or -1. |
|
noexcept |
Inserts a copy of another shape into the block.
If nBeforeShapeId is -1 added as last shape.
| nBeforeShapeId | The shape id before which the shape must be inserted or -1. |
| nCopyOfShapeId | The shape the inserted shouuld be copied from. |
|
noexcept |
The last shape id.
|
noexcept |
The maximum position of the visible bricks in a shape.
If the shape has no visible bricks the return value is {std::numeric_limits<int32_t>::lowest(), std::numeric_limits<int32_t>::lowest()}. The value is cached (not calculated for each call).
| nShapeId | The shape id. |
|
noexcept |
The maximum x position of the visible bricks in a shape.
If the shape has no visible bricks the return value is std::numeric_limits<int32_t>::lowest(). The value is cached (not calculated for each call).
| nShapeId | The shape id. |
|
noexcept |
The maximum y position of the visible bricks in a shape.
If the shape has no visible bricks the return value is std::numeric_limits<int32_t>::lowest(). The value is cached (not calculated for each call).
| nShapeId | The shape id. |
|
noexcept |
The minimum position of the visible bricks in a shape.
If the shape has no visible bricks the return value is {std::numeric_limits<int32_t>::max(), std::numeric_limits<int32_t>::max()}. The value is cached (not calculated for each call).
| nShapeId | The shape id. |
|
noexcept |
The minimum x position of the visible bricks in a shape.
If the shape has no visible bricks the return value is std::numeric_limits<int32_t>::max(). The value is cached (not calculated for each call).
| nShapeId | The shape id. |
|
noexcept |
The minimum y position of the visible bricks in a shape.
If the shape has no visible bricks the return value is std::numeric_limits<int32_t>::max(). The value is cached (not calculated for each call).
| nShapeId | The shape id. |
|
noexcept |
Modifies the given bricks: tuple<nBrickId, nX, nY, bVisible> The positions are set even if couldn't set the visibility of one or more bricks.
| nShapeId | The shape id. Must be valid. |
| aBrickPosition | The modified bricks as tuple<nBrickId, nX, nY, bVisible>. |
|
noexcept |
The shape id of the shape following another.
| nShapeId | The shape id the following of which is returned. |
|
noexcept |
The shape id of the shape preceding another.
| nShapeId | The shape id the preceding of which is returned. |
|
noexcept |
Removes a shape.
| nShapeId | The shape to remove. |
|
noexcept |
Remove all shapes that have no visible bricks.
|
noexcept |
The size of a given shape.
| nShapeId | The shape id. |
|
noexcept |
Total number of visible bricks of a shape.
| nShapeId | The shape id. Must be valid. |
|
noexcept |
The width of a given shape.
| nShapeId | The shape id. |
|
noexcept |
Swap two blocks.
| oBlock | The other block. |
|
inlinenoexcept |
The total number of bricks in the block.
|
inlinenoexcept |
The total number of shapes in the block.
|
noexcept |
The widest shape of the block.
1.8.13