9 #ifndef TurtleBrains_AnchorLocation_hpp
10 #define TurtleBrains_AnchorLocation_hpp
12 #include <turtle_brains/core/tb_string_utilities.hpp>
13 #include <turtle_brains/core/tb_dynamic_structure.hpp>
34 using AnchorLocation =
Anchor;
36 inline std::ostream& operator<<(std::ostream& output,
const AnchorLocation& anchor)
54 inline std::istream& operator>>(std::istream& input, AnchorLocation& anchor)
57 input >> anchorString;
58 tbCore::StringUtilities::LowercaseInPlace(anchorString);
61 else if (
"top_left" == anchorString ||
"topleft" == anchorString) { anchor =
Anchor::TopLeft; }
62 else if (
"top_center" == anchorString ||
"topcenter" == anchorString) { anchor =
Anchor::TopCenter; }
63 else if (
"top_right" == anchorString ||
"topright" == anchorString) { anchor =
Anchor::TopRight; }
64 else if (
"center_left" == anchorString ||
"centerleft" == anchorString) { anchor =
Anchor::CenterLeft; }
65 else if (
"center_right" == anchorString ||
"centerright" == anchorString) { anchor =
Anchor::CenterRight; }
66 else if (
"bottom_left" == anchorString ||
"bottomleft" == anchorString) { anchor =
Anchor::BottomLeft; }
67 else if (
"bottom_center" == anchorString ||
"bottomcenter" == anchorString) { anchor =
Anchor::BottomCenter; }
68 else if (
"bottom_right" == anchorString ||
"bottomright" == anchorString) { anchor =
Anchor::BottomRight; }
71 tb_error(
"tbError: Unknown value '%s' to convert into an AnchorLocation.", anchorString.c_str());
153 template<>
inline DynamicStructure ToDynamicStructure<Graphics::AnchorLocation>(
const Graphics::AnchorLocation& anchor)
158 template<>
inline Graphics::AnchorLocation FromDynamicStructure<Graphics::AnchorLocation>(
const DynamicStructure& data)
160 return Core::FromString<Graphics::AnchorLocation>(data.AsString());
#define tb_error(message,...)
Definition: tb_error.hpp:23
String ToString(const Type &object)
Definition: tb_string.hpp:317
std::string String
Definition: tb_string.hpp:302
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
Anchor
Definition: tb_anchor_location.hpp:22
@ TopRight
This anchor will set the origin to the top and right most corner of the Sprite.
@ Center
This anchor will set the origin to the center of the Sprite horizontally and vertically.
@ BottomRight
This anchor will set the origin to the bottom and right most corner of the Sprite.
@ TopCenter
This anchor will set the origin to the top and horizontal center of the Sprite.
@ BottomLeft
This anchor will set the origin to the bottom and left most corner of the Sprite.
@ CenterLeft
This anchor will set the origin to the center vertically and left most edge of the Sprite.
@ CenterRight
This anchor will set the origin to the center vertically and right most edge of the Sprite.
@ TopLeft
This anchor will set the origin to the top-left corner, effectively: SetOrigin(0.0f,...
@ BottomCenter
This anchor will set the origin to the bottom edge and horizontal center of the Sprite.
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:22