The aspect responsible for mapping points on the 3D game board to their equivalent coordinates on the game board data model.
More...
#include <board_locations.hpp>
|
| std::shared_ptr< BaseSimObjectAspect > | clone () const override |
| | Uses this aspect's data to construct a new aspect.
|
| |
| bool | onPointerLeftClick (glm::vec4 clickLocation) override |
| | Responds to left click events by logging them to the console, translating the location of the click to their game board grid coordinates.
|
| |
| bool | onPointerLeftRelease (glm::vec4 clickLocation) override |
| | Responds to a full left click by emitting mSigBoardClicked with the clicked location's equivalent game board coordinates, if possible.
|
| |
| glm::uvec2 | boardPointToGridIndices (glm::vec2 point) const |
| | Given the 2D coordinates of a point relative to the top surface of the board, returns the equivalent game board data model grid coordinates.
|
| |
| glm::vec4 | gridIndicesToBoardPoint (glm::u8vec2 gridIndices) const |
| | Translates game board data model grid coordinates to their real world 3D coordinates equivalent.
|
| |
|
| static std::string | getSimObjectAspectTypeName () |
| | Gets the aspect type string associated with this class.
|
| |
| static std::shared_ptr< BaseSimObjectAspect > | create (const nlohmann::json &jsonAspectProperties) |
| | Constructs this aspect from its JSON description.
|
| |
|
|
ToyMaker::Signal< glm::u8vec2 > | mSigBoardClicked { *this, "BoardClicked" } |
| | The event emitted signalling to the 3D viewport controller that a location on the board was clicked.
|
| |
|
|
| BoardLocations () |
| | Constructs a new Board Locations object.
|
| |
|
|
std::array< uint8_t, 3 > | mRowLengths {4, 12, 4} |
| | The lengths of the 3 rows of the game board representing the number of valid houses on it.
|
| |
The aspect responsible for mapping points on the 3D game board to their equivalent coordinates on the game board data model.
◆ boardPointToGridIndices()
| glm::uvec2 BoardLocations::boardPointToGridIndices |
( |
glm::vec2 | point | ) |
const |
Given the 2D coordinates of a point relative to the top surface of the board, returns the equivalent game board data model grid coordinates.
- Parameters
-
| point | The 2D coordinates of a point on the surface of the board. |
- Returns
- glm::uvec2 The game board grid coordinates.
◆ clone()
| std::shared_ptr< ToyMaker::BaseSimObjectAspect > BoardLocations::clone |
( |
| ) |
const |
|
override |
Uses this aspect's data to construct a new aspect.
- Returns
- std::shared_ptr<BaseSimObjectAspect> The newly constructed aspect.
◆ create()
| std::shared_ptr< ToyMaker::BaseSimObjectAspect > BoardLocations::create |
( |
const nlohmann::json & | jsonAspectProperties | ) |
|
|
static |
Constructs this aspect from its JSON description.
This is its appearance in JSON:
{ "type": "BoardLocations" }
- Parameters
-
| jsonAspectProperties | This aspect's description in JSON. |
- Returns
- std::shared_ptr<BaseSimObjectAspect> The newly constructed aspect.
◆ getSimObjectAspectTypeName()
| static std::string BoardLocations::getSimObjectAspectTypeName |
( |
| ) |
|
|
inlinestatic |
Gets the aspect type string associated with this class.
- Returns
- std::string This class' aspect type string.
◆ gridIndicesToBoardPoint()
| glm::vec4 BoardLocations::gridIndicesToBoardPoint |
( |
glm::u8vec2 | gridIndices | ) |
const |
Translates game board data model grid coordinates to their real world 3D coordinates equivalent.
- Parameters
-
| gridIndices | The game board data model grid location. |
- Returns
- glm::vec4 The equivalent 3D coordinates.
◆ onPointerLeftClick()
| bool BoardLocations::onPointerLeftClick |
( |
glm::vec4 | clickLocation | ) |
|
|
override |
Responds to left click events by logging them to the console, translating the location of the click to their game board grid coordinates.
- Parameters
-
| clickLocation | The 3D coordinates of the location on the board that was clicked. |
- Return values
-
| true | The location clicked corresponded to a real game board grid location. |
| false | The location clicked did not correspond to a real game board grid location. |
◆ onPointerLeftRelease()
| bool BoardLocations::onPointerLeftRelease |
( |
glm::vec4 | clickLocation | ) |
|
|
inlineoverride |
Responds to a full left click by emitting mSigBoardClicked with the clicked location's equivalent game board coordinates, if possible.
- Parameters
-
| clickLocation | The 3D coordinates of the point on the board that was clicked. |
- Return values
-
| true | The clicked location caused mSigBoardClicked to be emitted. |
| false | No signal was emitted as a result of this click. |
The documentation for this class was generated from the following files: