* \brief A PositionTransformer tells how a Coordinate should be transformed * depending of multiple parameters * \bind{PositionTransformer} */
| 39 | * \bind{PositionTransformer} |
| 40 | */ |
| 41 | class PositionTransformer |
| 42 | { |
| 43 | private: |
| 44 | CoordinateTransformer m_xTransformer; |
| 45 | std::string m_xTransformerName = "Camera"; |
| 46 | CoordinateTransformer m_yTransformer; |
| 47 | std::string m_yTransformerName = "Camera"; |
| 48 | |
| 49 | public: |
| 50 | /** |
| 51 | * \brief Default PositionTransformer constructor |
| 52 | */ |
| 53 | PositionTransformer(); |
| 54 | /** |
| 55 | * \brief Non-Default PositionTransformer constructor |
| 56 | * \param xTransformer Name of the Transformer the x Coordinate should |
| 57 | * use |
| 58 | * \param yTransformer Name of the Transformer the y Coordinate |
| 59 | * should use |
| 60 | */ |
| 61 | PositionTransformer( |
| 62 | const std::string& xTransformer, const std::string& yTransformer); |
| 63 | /** |
| 64 | * \brief Gets the CoordinateTransformer of x Coordinate |
| 65 | * \return The CoordinateTransformer of x Coordinate |
| 66 | */ |
| 67 | CoordinateTransformer& getXTransformer(); |
| 68 | /** |
| 69 | * \brief Gets the name of the CoordinateTransformer of x Coordinate |
| 70 | * \return The name of the CoordinateTransformer of x Coordinate in a |
| 71 | * std::string |
| 72 | */ |
| 73 | [[nodiscard]] std::string getXTransformerName() const; |
| 74 | /** |
| 75 | * \brief Gets the CoordinateTransformer of y Coordinate |
| 76 | * \return The CoordinateTransformer of y Coordinate |
| 77 | */ |
| 78 | CoordinateTransformer& getYTransformer(); |
| 79 | /** |
| 80 | * \brief Gets the name of the CoordinateTransformer of y Coordinate |
| 81 | * \return The name of the CoordinateTransformer of y Coordinate |
| 82 | */ |
| 83 | [[nodiscard]] std::string getYTransformerName() const; |
| 84 | /** |
| 85 | * \brief Method used by the Sprite to get the Position once |
| 86 | * transformed |
| 87 | * \param position Base Position of the element |
| 88 | * \param camera Position of the Camera |
| 89 | * \param layer Layer of the element |
| 90 | * \return The new transformer position |
| 91 | */ |
| 92 | Transform::UnitVector operator()(const Transform::UnitVector& position, |
| 93 | const Transform::UnitVector& camera, int layer) const; |
| 94 | }; |
| 95 | } // namespace obe::Graphics |