Spinning Topp Logo BlackTopp Studios
inc
unifieddim.h
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 
41 #ifndef _uiunifieddim_h
42 #define _uiunifieddim_h
43 
44 #include "rect.h"
45 
46 namespace Mezzanine
47 {
48  namespace UI
49  {
50  ///////////////////////////////////////////////////////////////////////////////
51  /// @class UnifiedDim
52  /// @headerfile unifieddim.h
53  /// @brief This class represents both the relative and absolute values that can be expressed for the values on one dimension for a UI renderable.
54  /// @details
55  ///////////////////////////////////////
57  {
58  public:
59  ///////////////////////////////////////////////////////////////////////////////
60  // Public Data Members
61 
62  /// @brief The relative value on this dimension.
64  /// @brief The absolute value on this dimension.
66 
67  ///////////////////////////////////////////////////////////////////////////////
68  // Construction and Destruction
69 
70  /// @brief Class constructor.
71  UnifiedDim() : Rel(0), Abs(0) {}
72  /// @brief Relative constructor.
73  /// @param Relative The relative portion of this dimension.
74  UnifiedDim(const Real& Relative)
75  : Rel(Relative), Abs(0) {}
76  /// @brief Descriptive constructor.
77  /// @param Relative The relative portion of this dimension.
78  /// @param Absolute The absolute portion of this dimension.
79  UnifiedDim(const Real& Relative, const Real& Absolute)
80  : Rel(Relative), Abs(Absolute) {}
81  /// @brief Copy constructor.
82  /// @param Other The other UnifiedDim to copy from.
83  UnifiedDim(const UnifiedDim& Other)
84  : Rel(Other.Rel), Abs(Other.Abs) {}
85  /// @brief Class destructor.
87 
88  ///////////////////////////////////////////////////////////////////////////////
89  // Utility
90 
91  /// @brief Sets the values of this dimension.
92  /// @param Relative The relative portion of this dimension.
93  /// @param Absolute The absolute portion of this dimension.
94  inline void SetValues(const Real& Relative, const Real& Absolute)
95  {
96  this->Rel = Relative;
97  this->Abs = Absolute;
98  }
99  /// @brief Sets all values of this dimension to zero.
100  inline void SetIdentity()
101  {
102  this->Rel = 0;
103  this->Abs = 0;
104  }
105 
106  /// @brief Calculates the actual value when a Real in pixels has this unified dim applied to it.
107  /// @param Actual A Real containing the actual(pixel) dimension to use as a base for the calculation.
108  /// @return Returns a Real containing the result dimension in actual (pixel) units.
109  inline Real CalculateActualDimension(const Real& Actual) const
110  {
111  return ( (this->Rel * Actual) + this->Abs );
112  }
113 
114  ///////////////////////////////////////////////////////////////////////////////
115  // Arithmetic Operators
116 
117  /// @brief Addition operator.
118  /// @param Other The other UnifiedDim to add to this.
119  /// @return Returns a new UnifiedDim that is the result of this operation.
120  inline UnifiedDim operator+(const UnifiedDim& Other) const
121  {
122  return UnifiedDim(this->Rel + Other.Rel, this->Abs + Other.Abs);
123  }
124  /// @brief Subtraction operator.
125  /// @param Other The other UnifiedDim to subtract from this.
126  /// @return Returns a new UnifiedDim that is the result of this operation.
127  inline UnifiedDim operator-(const UnifiedDim& Other) const
128  {
129  return UnifiedDim(this->Rel - Other.Rel, this->Abs - Other.Abs);
130  }
131  /// @brief Multiplication operator.
132  /// @param Other The other UnifiedDim to multiply by.
133  /// @return Returns a new UnifiedDim that is the result of this operation.
134  inline UnifiedDim operator*(const UnifiedDim& Other) const
135  {
136  return UnifiedDim(this->Rel * Other.Rel, this->Abs * Other.Abs);
137  }
138  /// @brief Division operator.
139  /// @param Other The other UnifiedDim to divide by.
140  /// @return Returns a new UnifiedDim that is the result of this operation.
141  inline UnifiedDim operator/(const UnifiedDim& Other) const
142  {
143  return UnifiedDim(Other.Rel == 0.0f ? 0.0f : this->Rel / Other.Rel,
144  Other.Abs == 0.0f ? 0.0f : this->Abs / Other.Abs);
145  }
146 
147  /// @brief Addition assignment operator.
148  /// @param Other The other UnifiedDim to add to this.
149  /// @return Returns a reference to this.
150  inline UnifiedDim& operator+=(const UnifiedDim& Other)
151  {
152  this->Rel += Other.Rel;
153  this->Abs += Other.Abs;
154  return *this;
155  }
156  /// @brief Subtraction assignment operator.
157  /// @param Other The other UnifiedDim to subtract from this.
158  /// @return Returns a reference to this.
159  inline UnifiedDim& operator-=(const UnifiedDim& Other)
160  {
161  this->Rel -= Other.Rel;
162  this->Abs -= Other.Abs;
163  return *this;
164  }
165  /// @brief Multiplication assignment operator.
166  /// @param Other The other UnifiedDim to multiply by.
167  /// @return Returns a reference to this.
168  inline UnifiedDim& operator*=(const UnifiedDim& Other)
169  {
170  this->Rel *= Other.Rel;
171  this->Abs *= Other.Abs;
172  return *this;
173  }
174  /// @brief Division assignment operator.
175  /// @param Other The other UnifiedDim to divide by.
176  /// @return Returns a reference to this.
177  inline UnifiedDim& operator/=(const UnifiedDim& Other)
178  {
179  this->Rel = (Other.Rel == 0.0f ? 0.0f : this->Rel / Other.Rel);
180  this->Abs = (Other.Abs == 0.0f ? 0.0f : this->Abs / Other.Abs);
181  return *this;
182  }
183 
184  ///////////////////////////////////////////////////////////////////////////////
185  // Arithmetic with Real Operators
186 
187  /// @brief Multiplication with Real operator.
188  /// @param Other The Real to multiply by.
189  /// @return Returns a new UnifiedDim that is the result of this operation.
190  inline UnifiedDim operator*(const Real& Other)
191  {
192  return UnifiedDim( this->Rel * Other, this->Abs * Other );
193  }
194  /// @brief Division with Real operator.
195  /// @param Other The Real to divide by.
196  /// @return Returns a new UnifiedDim that is the result of this operation.
197  inline UnifiedDim operator/(const Real& Other)
198  {
199  return UnifiedDim( ( Other == 0 ? 0.0 : this->Rel / Other ),
200  ( Other == 0 ? 0.0 : this->Abs / Other ) );
201  }
202 
203  /// @brief Multiplication assignment with Real operator.
204  /// @param Other The Real to multiply by.
205  /// @return Returns a reference to this.
206  inline UnifiedDim& operator*=(const Real& Other)
207  {
208  this->Rel *= Other;
209  this->Abs *= Other;
210  return *this;
211  }
212  /// @brief Division assignment with Real operator.
213  /// @param Other The Real to divide by.
214  /// @return Returns a reference to this.
215  inline UnifiedDim& operator/=(const Real& Other)
216  {
217  this->Rel /= Other;
218  this->Abs /= Other;
219  return *this;
220  }
221 
222  ///////////////////////////////////////////////////////////////////////////////
223  // Comparison Operators
224 
225  /// @brief Equality comparison operator.
226  /// @param Other The other UnifiedDim to compare to.
227  /// @return Returns true if these UnifiedDim's are equal, false otherwise.
228  inline Boole operator==(const UnifiedDim& Other) const
229  {
230  return this->Rel == Other.Rel && this->Abs == Other.Abs;
231  }
232  /// @brief Inequality comparison operator.
233  /// @param Other The other UnifiedDim to compare to.
234  /// @return Returns true if these UnifiedDim's are not equal, false otherwise.
235  inline Boole operator!=(const UnifiedDim& Other) const
236  {
237  return this->Rel != Other.Rel || this->Abs != Other.Abs;
238  }
239 
240  ///////////////////////////////////////////////////////////////////////////////
241  // Other Operators
242 
243  /// @brief Assignment operator.
244  /// @param Other The other UnifiedDim to be assign values from.
245  /// @return Returns a reference to this.
246  inline UnifiedDim& operator=(const UnifiedDim& Other)
247  {
248  this->Rel = Other.Rel;
249  this->Abs = Other.Abs;
250  return *this;
251  }
252 
253  ///////////////////////////////////////////////////////////////////////////////
254  // Serialization
255 
256  /// @brief Convert this class to an XML::Node ready for serialization.
257  /// @param ParentNode The point in the XML hierarchy that all this renderable should be appended to.
258  void ProtoSerialize(XML::Node& ParentNode) const
259  {
260  XML::Node DimNode = ParentNode.AppendChild( UnifiedDim::GetSerializableName() );
261 
262  if( DimNode.AppendAttribute("Version").SetValue("1") &&
263  DimNode.AppendAttribute("Rel").SetValue(this->Rel) &&
264  DimNode.AppendAttribute("Abs").SetValue(this->Abs) )
265  {
266  return;
267  }else{
268  SerializeError("Create XML Attribute Values",UnifiedDim::GetSerializableName(),true);
269  }
270  }
271  /// @brief Take the data stored in an XML Node and overwrite this object with it.
272  /// @param SelfRoot An XML::Node containing the data to populate this class with.
273  void ProtoDeSerialize(const XML::Node& SelfRoot)
274  {
275  XML::Attribute CurrAttrib;
276  if( SelfRoot.Name() == UnifiedDim::GetSerializableName() ) {
277  if(SelfRoot.GetAttribute("Version").AsInt() == 1) {
278  CurrAttrib = SelfRoot.GetAttribute("Rel");
279  if( !CurrAttrib.Empty() )
280  this->Rel = CurrAttrib.AsReal();
281 
282  CurrAttrib = SelfRoot.GetAttribute("Abs");
283  if( !CurrAttrib.Empty() )
284  this->Abs = CurrAttrib.AsReal();
285  }else{
286  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + UnifiedDim::GetSerializableName() + ": Not Version 1.");
287  }
288  }else{
289  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,UnifiedDim::GetSerializableName() + " was not found in the provided XML node, which was expected.");
290  }
291  }
292  /// @brief Get the name of the the XML tag the Renderable class will leave behind as its instances are serialized.
293  /// @return A string containing the name of this class.
295  {
296  return "UnifiedDim";
297  }
298  };//UnifiedDim
299 
300  ///////////////////////////////////////////////////////////////////////////////
301  /// @class UnifiedVec2
302  /// @headerfile unifieddim.h
303  /// @brief This class represents a point in 2D space using UnifiedDim's.
304  /// @details
305  ///////////////////////////////////////
307  {
308  public:
309  ///////////////////////////////////////////////////////////////////////////////
310  // Public Data Members
311 
312  /// @brief The dimension on the X plane.
314  /// @brief The dimension on the Y plane.
316 
317  ///////////////////////////////////////////////////////////////////////////////
318  // Construction and Destruction
319 
320  /// @brief Class constructor.
322  {
323  this->X.SetIdentity();
324  this->Y.SetIdentity();
325  }
326  /// @brief Real constructor.
327  /// @param x The dimension on the X plane.
328  /// @param y The dimension on the Y plane.
329  UnifiedVec2(const Real& x, const Real& y)
330  : X(x), Y(y) {}
331  /// @brief UnifiedDim constructor.
332  /// @param x The dimension on the X plane.
333  /// @param y The dimension on the Y plane.
334  UnifiedVec2(const UnifiedDim& x, const UnifiedDim& y)
335  : X(x), Y(y) {}
336  /// @brief Real constructor.
337  /// @param Xrel The relative portion of the X dimension.
338  /// @param Yrel The relative portion of the Y dimension.
339  /// @param Xabs The absolute portion of the X dimension.
340  /// @param Yabs the absolute portion of the Y dimension.
341  UnifiedVec2(const Real& Xrel, const Real& Yrel, const Real& Xabs, const Real& Yabs)
342  {
343  this->X.SetValues(Xrel,Xabs);
344  this->Y.SetValues(Yrel,Yabs);
345  }
346  /// @brief Copy constructor.
347  /// @param Other The other UnifiedVec2 to copy from.
348  UnifiedVec2(const UnifiedVec2& Other)
349  : X(Other.X), Y(Other.Y) {}
350  /// @brief Class destructor.
352 
353  ///////////////////////////////////////////////////////////////////////////////
354  // Utility
355 
356  /// @brief Sets all data members of this unified vector explicitly.
357  /// @param x The dimension on the X plane.
358  /// @param y The dimension on the Y plane.
359  inline void SetValues(const UnifiedDim& x, const UnifiedDim& y)
360  {
361  this->X = x;
362  this->Y = y;
363  }
364  /// @brief Sets all data members of this unified vector explicitly.
365  /// @param Xrel The relative portion of the X dimension.
366  /// @param Yrel The relative portion of the Y dimension.
367  /// @param Xabs The absolute portion of the X dimension.
368  /// @param Yabs the absolute portion of the Y dimension.
369  inline void SetValues(const Real& Xrel, const Real& Yrel, const Real& Xabs, const Real& Yabs)
370  {
371  this->X.SetValues(Xrel,Xabs);
372  this->Y.SetValues(Yrel,Yabs);
373  }
374  /// @brief Sets all members of this unified vector to zero.
375  inline void SetIdentity()
376  {
377  this->X.SetIdentity();
378  this->Y.SetIdentity();
379  }
380 
381  /// @brief Calculates the actual values when a Vector2 with actual dimensions has this unified vector2 applied to it.
382  /// @param Actual A Vector2 containing the actual(pixel) dimensions to use as a base for the calculation.
383  /// @return Returns a Vector2 containing the result dimensions in actual (pixel) units.
384  inline Vector2 CalculateActualDimensions(const Vector2& Actual) const
385  {
386  return Vector2( this->X.CalculateActualDimension(Actual.X),
387  this->Y.CalculateActualDimension(Actual.Y) );
388  }
389 
390  ///////////////////////////////////////////////////////////////////////////////
391  // Arithmetic Operators
392 
393  /// @brief Addition operator.
394  /// @param Other The other UnifiedVec2 to add to this.
395  /// @return Returns a new UnifiedVec2 that is the result of this operation.
396  inline UnifiedVec2 operator+(const UnifiedVec2& Other) const
397  {
398  return UnifiedVec2(this->X + Other.X, this->Y + Other.Y);
399  }
400  /// @brief Subtraction operator.
401  /// @param Other The other UnifiedVec2 to subtract from this.
402  /// @return Returns a new UnifiedVec2 that is the result of this operation.
403  inline UnifiedVec2 operator-(const UnifiedVec2& Other) const
404  {
405  return UnifiedVec2(this->X - Other.X, this->Y - Other.Y);
406  }
407  /// @brief Multiplication operator.
408  /// @param Other The other UnifiedVec2 to multiply by.
409  /// @return Returns a new UnifiedVec2 that is the result of this operation.
410  inline UnifiedVec2 operator*(const UnifiedVec2& Other) const
411  {
412  return UnifiedVec2(this->X * Other.X, this->Y * Other.Y);
413  }
414  /// @brief Division operator.
415  /// @param Other The other UnifiedVec2 to divide by.
416  /// @return Returns a new UnifiedVec2 that is the result of this operation.
417  inline UnifiedVec2 operator/(const UnifiedVec2& Other) const
418  {
419  return UnifiedVec2(this->X / Other.X,
420  this->Y / Other.Y);
421  }
422 
423  /// @brief Addition assignment operator.
424  /// @param Other The other UnifiedVec2 to add to this.
425  /// @return Returns a reference to this.
426  inline UnifiedVec2& operator+=(const UnifiedVec2& Other)
427  {
428  this->X += Other.X;
429  this->Y += Other.Y;
430  return *this;
431  }
432  /// @brief Subtraction assignment operator.
433  /// @param Other The other UnifiedVec2 to subtract from this.
434  /// @return Returns a reference to this.
435  inline UnifiedVec2& operator-=(const UnifiedVec2& Other)
436  {
437  this->X -= Other.X;
438  this->Y -= Other.Y;
439  return *this;
440  }
441  /// @brief Multiplication assignment operator.
442  /// @param Other The other UnifiedVec2 to multiply by.
443  /// @return Returns a reference to this.
444  inline UnifiedVec2& operator*=(const UnifiedVec2& Other)
445  {
446  this->X *= Other.X;
447  this->Y *= Other.Y;
448  return *this;
449  }
450  /// @brief Division assignment operator.
451  /// @param Other The other UnifiedVec2 to divide by.
452  /// @return Returns a reference to this.
453  inline UnifiedVec2& operator/=(const UnifiedVec2& Other)
454  {
455  this->X = this->X / Other.X;
456  this->Y = this->Y / Other.Y;
457  return *this;
458  }
459 
460  ///////////////////////////////////////////////////////////////////////////////
461  // Arithmetic with UnifiedDim Operators
462 
463  /// @brief Addition with UnifiedDim operator.
464  /// @param Other The other UnifiedDim to add to this.
465  /// @return Returns a new UnifiedDim that is the result of this operation.
466  inline UnifiedVec2 operator+(const UnifiedDim& Other) const
467  {
468  return UnifiedVec2(this->X + Other, this->Y + Other);
469  }
470  /// @brief Subtraction with UnifiedDim operator.
471  /// @param Other The other UnifiedDim to subtract from this.
472  /// @return Returns a new UnifiedDim that is the result of this operation.
473  inline UnifiedVec2 operator-(const UnifiedDim& Other) const
474  {
475  return UnifiedVec2(this->X - Other, this->Y - Other);
476  }
477  /// @brief Multiplication with UnifiedDim operator.
478  /// @param Other The other UnifiedDim to multiply by.
479  /// @return Returns a new UnifiedDim that is the result of this operation.
480  inline UnifiedVec2 operator*(const UnifiedDim& Other) const
481  {
482  return UnifiedVec2(this->X * Other, this->Y * Other);
483  }
484  /// @brief Division with UnifiedDim operator.
485  /// @param Other The other UnifiedDim to divide by.
486  /// @return Returns a new UnifiedDim that is the result of this operation.
487  inline UnifiedVec2 operator/(const UnifiedDim& Other) const
488  {
489  return UnifiedVec2(this->X / Other,
490  this->Y / Other);
491  }
492 
493  /// @brief Addition assignment with UnifiedDim operator.
494  /// @param Other The other UnifiedDim to add to this.
495  /// @return Returns a reference to this.
496  inline UnifiedVec2& operator+=(const UnifiedDim& Other)
497  {
498  this->X += Other;
499  this->Y += Other;
500  return *this;
501  }
502  /// @brief Subtraction assignment with UnifiedDim operator.
503  /// @param Other The other UnifiedDim to subtract from this.
504  /// @return Returns a reference to this.
505  inline UnifiedVec2& operator-=(const UnifiedDim& Other)
506  {
507  this->X -= Other;
508  this->Y -= Other;
509  return *this;
510  }
511  /// @brief Multiplication assignment with UnifiedDim operator.
512  /// @param Other The other UnifiedDim to multiply by.
513  /// @return Returns a reference to this.
514  inline UnifiedVec2& operator*=(const UnifiedDim& Other)
515  {
516  this->X *= Other;
517  this->Y *= Other;
518  return *this;
519  }
520  /// @brief Division assignment with UnifiedDim operator.
521  /// @param Other The other UnifiedDim to divide by.
522  /// @return Returns a reference to this.
523  inline UnifiedVec2& operator/=(const UnifiedDim& Other)
524  {
525  this->X = this->X / Other;
526  this->Y = this->Y / Other;
527  return *this;
528  }
529 
530  ///////////////////////////////////////////////////////////////////////////////
531  // Arithmetic with Real Operators
532 
533  /// @brief Multiplication with Real operator.
534  /// @param Other The Real to multiply by.
535  /// @return Returns a new UnifiedVec2 that is the result of this operation.
536  inline UnifiedVec2 operator*(const Real& Other)
537  {
538  return UnifiedVec2( this->X * Other, this->Y * Other );
539  }
540  /// @brief Division with Real operator.
541  /// @param Other The Real to divide by.
542  /// @return Returns a new UnifiedVec2 that is the result of this operation.
543  inline UnifiedVec2 operator/(const Real& Other)
544  {
545  return UnifiedVec2( this->X / Other, this->Y / Other );
546  }
547 
548  /// @brief Multiplication assignment with Real operator.
549  /// @param Other The Real to multiply by.
550  /// @return Returns a reference to this.
551  inline UnifiedVec2& operator*=(const Real& Other)
552  {
553  this->X *= Other;
554  this->Y *= Other;
555  return *this;
556  }
557  /// @brief Division assignment with Real operator.
558  /// @param Other The Real to divide by.
559  /// @return Returns a reference to this.
560  inline UnifiedVec2& operator/=(const Real& Other)
561  {
562  this->X /= Other;
563  this->Y /= Other;
564  return *this;
565  }
566 
567  ///////////////////////////////////////////////////////////////////////////////
568  // Comparison Operators
569 
570  /// @brief Equality comparison operator.
571  /// @param Other The other UnifiedVec2 to compare to.
572  /// @return Returns true if these UnifiedVec2's are equal, false otherwise.
573  inline Boole operator==(const UnifiedVec2& Other) const
574  {
575  return this->X == Other.X && this->Y == Other.Y;
576  }
577  /// @brief Inequality comparison operator.
578  /// @param Other The other UnifiedVec2 to compare to.
579  /// @return Returns true if these UnifiedVec2's are not equal, false otherwise.
580  inline Boole operator!=(const UnifiedVec2& Other) const
581  {
582  return this->X != Other.X || this->Y != Other.Y;
583  }
584 
585  ///////////////////////////////////////////////////////////////////////////////
586  // Other Operators
587 
588  /// @brief Assignment operator.
589  /// @param Other The other UnifiedVec2 to be assign values from.
590  /// @return Returns a reference to this.
591  inline UnifiedVec2& operator=(const UnifiedVec2& Other)
592  {
593  this->X = Other.X;
594  this->Y = Other.Y;
595  return *this;
596  }
597 
598  ///////////////////////////////////////////////////////////////////////////////
599  // Serialization
600 
601  /// @brief Convert this class to an XML::Node ready for serialization.
602  /// @param ParentNode The point in the XML hierarchy that all this renderable should be appended to.
603  void ProtoSerialize(XML::Node& ParentNode) const
604  {
605  XML::Node Vec2Node = ParentNode.AppendChild( UnifiedVec2::GetSerializableName() );
606 
607  if( Vec2Node.AppendAttribute("Version").SetValue("1") &&
608  Vec2Node.AppendAttribute("XRel").SetValue(this->X.Rel) &&
609  Vec2Node.AppendAttribute("YRel").SetValue(this->Y.Rel) &&
610  Vec2Node.AppendAttribute("XAbs").SetValue(this->X.Abs) &&
611  Vec2Node.AppendAttribute("YAbs").SetValue(this->Y.Abs) )
612  {
613  return;
614  }else{
615  SerializeError("Create XML Attribute Values",UnifiedVec2::GetSerializableName(),true);
616  }
617  }
618  /// @brief Take the data stored in an XML Node and overwrite this object with it.
619  /// @param SelfRoot An XML::Node containing the data to populate this class with.
620  void ProtoDeSerialize(const XML::Node& SelfRoot)
621  {
622  XML::Attribute CurrAttrib;
623  if( SelfRoot.Name() == UnifiedVec2::GetSerializableName() ) {
624  if(SelfRoot.GetAttribute("Version").AsInt() == 1) {
625  CurrAttrib = SelfRoot.GetAttribute("XRel");
626  if( !CurrAttrib.Empty() )
627  this->X.Rel = CurrAttrib.AsReal();
628 
629  CurrAttrib = SelfRoot.GetAttribute("YRel");
630  if( !CurrAttrib.Empty() )
631  this->Y.Rel = CurrAttrib.AsReal();
632 
633  CurrAttrib = SelfRoot.GetAttribute("XAbs");
634  if( !CurrAttrib.Empty() )
635  this->X.Abs = CurrAttrib.AsReal();
636 
637  CurrAttrib = SelfRoot.GetAttribute("YAbs");
638  if( !CurrAttrib.Empty() )
639  this->Y.Abs = CurrAttrib.AsReal();
640  }else{
641  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + UnifiedVec2::GetSerializableName() + ": Not Version 1.");
642  }
643  }else{
644  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,UnifiedVec2::GetSerializableName() + " was not found in the provided XML node, which was expected.");
645  }
646  }
647  /// @brief Get the name of the the XML tag the Renderable class will leave behind as its instances are serialized.
648  /// @return A string containing the name of this class.
650  {
651  return "UnifiedVec2";
652  }
653  };//UnifiedVec2
654 
655  ///////////////////////////////////////////////////////////////////////////////
656  /// @class UnifiedRect
657  /// @headerfile unifieddim.h
658  /// @brief This class represents a 2D rect which can express the size and position of a renderable on screen.
659  /// @details
660  ///////////////////////////////////////
662  {
663  public:
664  ///////////////////////////////////////////////////////////////////////////////
665  // Public Data Members
666 
667  /// @brief The top left position of this rect.
669  /// @brief The width and height of this rect.
671 
672  ///////////////////////////////////////////////////////////////////////////////
673  // Construction and Destruction
674 
675  /// @brief Class constructor.
677  {
678  this->Position.SetIdentity();
679  this->Size.SetIdentity();
680  }
681  /// @brief UnifiedVec2 constructor.
682  /// @param Pos The screen position of the rect.
683  /// @param Area The width and height of the rect.
684  UnifiedRect(const UnifiedVec2& Pos, const UnifiedVec2& Area)
685  : Position(Pos), Size(Area) {}
686  /// @brief UnifiedDim constructor.
687  /// @param PositionX The position on the X plane.
688  /// @param PositionY The position on the Y plane.
689  /// @param SizeX The size on the X plane.
690  /// @param SizeY The size on the Y plane.
691  UnifiedRect(const UnifiedDim& PositionX, const UnifiedDim& PositionY, const UnifiedDim& SizeX, const UnifiedDim& SizeY)
692  {
693  this->Position.SetValues(PositionX,PositionY);
694  this->Size.SetValues(SizeX,SizeY);
695  }
696  /// @brief Relative Real constructor.
697  /// @param PositionXrel The relative position portion of the X dimension.
698  /// @param PositionYrel The relative position portion of the Y dimension.
699  /// @param SizeXrel The relative size portion of the X dimension.
700  /// @param SizeYrel The relative size portion of the Y dimension.
701  UnifiedRect(const Real& PositionXrel, const Real& PositionYrel, const Real& SizeXrel, const Real& SizeYrel)
702  {
703  this->Position.SetValues(PositionXrel,PositionYrel,0.0,0.0);
704  this->Size.SetValues(SizeXrel,SizeYrel,0.0,0.0);
705  }
706  /// @brief Real constructor.
707  /// @param PositionXrel The relative position portion of the X dimension.
708  /// @param PositionYrel The relative position portion of the Y dimension.
709  /// @param SizeXrel The relative size portion of the X dimension.
710  /// @param SizeYrel The relative size portion of the Y dimension.
711  /// @param PositionXabs The absolute position portion of the X dimension.
712  /// @param PositionYabs the absolute position portion of the Y dimension.
713  /// @param SizeXabs The absolute size portion of the X dimension.
714  /// @param SizeYabs the absolute size portion of the Y dimension.
715  UnifiedRect(const Real& PositionXrel, const Real& PositionYrel, const Real& SizeXrel, const Real& SizeYrel,
716  const Real& PositionXabs, const Real& PositionYabs, const Real& SizeXabs, const Real& SizeYabs)
717  {
718  this->Position.SetValues(PositionXrel,PositionYrel,PositionXabs,PositionYabs);
719  this->Size.SetValues(SizeXrel,SizeYrel,SizeXabs,SizeYabs);
720  }
721  /// @brief Class destructor.
723 
724  ///////////////////////////////////////////////////////////////////////////////
725  // Utility
726 
727  /// @brief Sets all data members of this unified rect explicitly.
728  /// @param Pos The screen position of the rect.
729  /// @param Area The width and height of the rect.
730  inline void SetValues(const UnifiedVec2& Pos, const UnifiedVec2& Area)
731  {
732  this->Position = Pos;
733  this->Size = Area;
734  }
735  /// @brief Sets all data members of this unified rect explicitly.
736  /// @param PositionX The position on the X plane.
737  /// @param PositionY The position on the Y plane.
738  /// @param SizeX The size on the X plane.
739  /// @param SizeY The size on the Y plane.
740  inline void SetValues(const UnifiedDim& PositionX, const UnifiedDim& PositionY, const UnifiedDim& SizeX, const UnifiedDim& SizeY)
741  {
742  this->Position.SetValues(PositionX,PositionY);
743  this->Size.SetValues(SizeX,SizeY);
744  }
745  /// @brief Sets all data members of this unified rect explicitly.
746  /// @param PositionXrel The relative position portion of the X dimension.
747  /// @param PositionYrel The relative position portion of the Y dimension.
748  /// @param SizeXrel The relative size portion of the X dimension.
749  /// @param SizeYrel The relative size portion of the Y dimension.
750  /// @param PositionXabs The absolute position portion of the X dimension.
751  /// @param PositionYabs the absolute position portion of the Y dimension.
752  /// @param SizeXabs The absolute size portion of the X dimension.
753  /// @param SizeYabs the absolute size portion of the Y dimension.
754  inline void SetValues(const Real& PositionXrel, const Real& PositionYrel, const Real& SizeXrel, const Real& SizeYrel,
755  const Real& PositionXabs, const Real& PositionYabs, const Real& SizeXabs, const Real& SizeYabs)
756  {
757  this->Position.SetValues(PositionXrel,PositionYrel,PositionXabs,PositionYabs);
758  this->Size.SetValues(SizeXrel,SizeYrel,SizeXabs,SizeYabs);
759  }
760  /// @brief Sets all members of this unified rect to zero.
761  inline void SetIdentity()
762  {
763  this->Position.SetIdentity();
764  this->Size.SetIdentity();
765  }
766 
767  /// @brief Calculates the actual values when a Rect with actual dimensions has this unified rect applied to it.
768  /// @param Actual A Rect containing the actual(pixel) position and size to use as a base for the calculation.
769  /// @param AsChild Whether or not the dimensions should be calculated assuming this is a child rect.
770  /// @return Returns a Rect containing the result position and size in actual (pixel) units.
771  inline Rect CalculateActualDimensions(const Rect& Actual, Boole AsChild = true) const
772  {
773  Vector2 Pos = this->Position.CalculateActualDimensions(Actual.Size);
774  Vector2 Size = this->Size.CalculateActualDimensions(Actual.Size);
775  return Rect( ( AsChild ? Pos + Actual.Position : Pos ), Size );
776  }
777 
778  ///////////////////////////////////////////////////////////////////////////////
779  // Comparison Operators
780 
781  /// @brief Equality comparison operator.
782  /// @param Other The other UnifiedRect to compare to.
783  /// @return Returns true if these UnifiedRect's are equal, false otherwise.
784  inline Boole operator==(const UnifiedRect& Other) const
785  {
786  return this->Position == Other.Position && this->Size == Other.Size;
787  }
788  /// @brief Inequality comparison operator.
789  /// @param Other The other UnifiedRect to compare to.
790  /// @return Returns true if these UnifiedRect's are not equal, false otherwise.
791  inline Boole operator!=(const UnifiedRect& Other) const
792  {
793  return this->Position != Other.Position || this->Size != Other.Size;
794  }
795 
796  ///////////////////////////////////////////////////////////////////////////////
797  // Other Operators
798 
799  /// @brief Assignment operator.
800  /// @param Other The other UnifiedRect to be assign values from.
801  /// @return Returns a reference to this.
802  inline UnifiedRect& operator=(const UnifiedRect& Other)
803  {
804  this->Position = Other.Position;
805  this->Size = Other.Size;
806  return *this;
807  }
808 
809  ///////////////////////////////////////////////////////////////////////////////
810  // Serialization
811 
812  /// @brief Convert this class to an XML::Node ready for serialization.
813  /// @param ParentNode The point in the XML hierarchy that all this renderable should be appended to.
814  void ProtoSerialize(XML::Node& ParentNode) const
815  {
816  XML::Node RectNode = ParentNode.AppendChild( UnifiedRect::GetSerializableName() );
817 
818  if( RectNode.AppendAttribute("Version").SetValue("1") &&
819  RectNode.AppendAttribute("PositionXRel").SetValue(this->Position.X.Rel) &&
820  RectNode.AppendAttribute("PositionYRel").SetValue(this->Position.Y.Rel) &&
821  RectNode.AppendAttribute("SizeXRel").SetValue(this->Size.X.Rel) &&
822  RectNode.AppendAttribute("SizeYRel").SetValue(this->Size.Y.Rel) &&
823  RectNode.AppendAttribute("PositionXAbs").SetValue(this->Position.X.Abs) &&
824  RectNode.AppendAttribute("PositionYAbs").SetValue(this->Position.Y.Abs) &&
825  RectNode.AppendAttribute("SizeXAbs").SetValue(this->Size.X.Abs) &&
826  RectNode.AppendAttribute("SizeYAbs").SetValue(this->Size.Y.Abs) )
827  {
828  return;
829  }else{
830  SerializeError("Create XML Attribute Values",UnifiedRect::GetSerializableName(),true);
831  }
832  }
833  /// @brief Take the data stored in an XML Node and overwrite this object with it.
834  /// @param SelfRoot An XML::Node containing the data to populate this class with.
835  void ProtoDeSerialize(const XML::Node& SelfRoot)
836  {
837  XML::Attribute CurrAttrib;
838  if( SelfRoot.Name() == UnifiedRect::GetSerializableName() ) {
839  if(SelfRoot.GetAttribute("Version").AsInt() == 1) {
840  CurrAttrib = SelfRoot.GetAttribute("PositionXRel");
841  if( !CurrAttrib.Empty() )
842  this->Position.X.Rel = CurrAttrib.AsReal();
843 
844  CurrAttrib = SelfRoot.GetAttribute("PositionYRel");
845  if( !CurrAttrib.Empty() )
846  this->Position.Y.Rel = CurrAttrib.AsReal();
847 
848  CurrAttrib = SelfRoot.GetAttribute("SizeXRel");
849  if( !CurrAttrib.Empty() )
850  this->Size.X.Rel = CurrAttrib.AsReal();
851 
852  CurrAttrib = SelfRoot.GetAttribute("SizeYRel");
853  if( !CurrAttrib.Empty() )
854  this->Size.Y.Rel = CurrAttrib.AsReal();
855 
856  CurrAttrib = SelfRoot.GetAttribute("PositionXAbs");
857  if( !CurrAttrib.Empty() )
858  this->Position.X.Abs = CurrAttrib.AsReal();
859 
860  CurrAttrib = SelfRoot.GetAttribute("PositionYAbs");
861  if( !CurrAttrib.Empty() )
862  this->Position.Y.Abs = CurrAttrib.AsReal();
863 
864  CurrAttrib = SelfRoot.GetAttribute("SizeXAbs");
865  if( !CurrAttrib.Empty() )
866  this->Size.X.Abs = CurrAttrib.AsReal();
867 
868  CurrAttrib = SelfRoot.GetAttribute("SizeYAbs");
869  if( !CurrAttrib.Empty() )
870  this->Size.Y.Abs = CurrAttrib.AsReal();
871  }else{
872  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + UnifiedRect::GetSerializableName() + ": Not Version 1.");
873  }
874  }else{
875  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,UnifiedRect::GetSerializableName() + " was not found in the provided XML node, which was expected.");
876  }
877  }
878  /// @brief Get the name of the the XML tag the Renderable class will leave behind as its instances are serialized.
879  /// @return A string containing the name of this class.
881  {
882  return "UnifiedRect";
883  }
884  };//UnifiedRect
885  }//UI
886 }//Mezzanine
887 
888 #endif
UnifiedRect(const Real &PositionXrel, const Real &PositionYrel, const Real &SizeXrel, const Real &SizeYrel)
Relative Real constructor.
Definition: unifieddim.h:701
UnifiedDim(const Real &Relative)
Relative constructor.
Definition: unifieddim.h:74
UnifiedVec2 operator-(const UnifiedVec2 &Other) const
Subtraction operator.
Definition: unifieddim.h:403
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
A light-weight handle for manipulating attributes in DOM tree.
Definition: attribute.h:74
void SetValues(const UnifiedVec2 &Pos, const UnifiedVec2 &Area)
Sets all data members of this unified rect explicitly.
Definition: unifieddim.h:730
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
Definition: unifieddim.h:649
UnifiedVec2 & operator*=(const Real &Other)
Multiplication assignment with Real operator.
Definition: unifieddim.h:551
UnifiedVec2 operator/(const Real &Other)
Division with Real operator.
Definition: unifieddim.h:543
UnifiedVec2 operator/(const UnifiedVec2 &Other) const
Division operator.
Definition: unifieddim.h:417
UnifiedDim X
The dimension on the X plane.
Definition: unifieddim.h:313
UnifiedDim & operator-=(const UnifiedDim &Other)
Subtraction assignment operator.
Definition: unifieddim.h:159
Boole operator!=(const UnifiedRect &Other) const
Inequality comparison operator.
Definition: unifieddim.h:791
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
UnifiedVec2 Size
The width and height of this rect.
Definition: unifieddim.h:670
void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
Definition: unifieddim.h:814
UnifiedDim & operator/=(const Real &Other)
Division assignment with Real operator.
Definition: unifieddim.h:215
UnifiedVec2 & operator-=(const UnifiedDim &Other)
Subtraction assignment with UnifiedDim operator.
Definition: unifieddim.h:505
Vector2 Size
Vector2 representing the width and height of the rect.
Definition: rect.h:71
Real Rel
The relative value on this dimension.
Definition: unifieddim.h:63
UnifiedRect(const UnifiedVec2 &Pos, const UnifiedVec2 &Area)
UnifiedVec2 constructor.
Definition: unifieddim.h:684
Thrown when the requested identity could not be found.
Definition: exception.h:94
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Definition: exception.h:3048
void SetIdentity()
Sets all values of this dimension to zero.
Definition: unifieddim.h:100
void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Definition: unifieddim.h:835
UnifiedDim operator/(const Real &Other)
Division with Real operator.
Definition: unifieddim.h:197
UnifiedVec2 & operator*=(const UnifiedVec2 &Other)
Multiplication assignment operator.
Definition: unifieddim.h:444
UnifiedVec2 & operator+=(const UnifiedDim &Other)
Addition assignment with UnifiedDim operator.
Definition: unifieddim.h:496
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Definition: exception.h:112
UnifiedDim operator-(const UnifiedDim &Other) const
Subtraction operator.
Definition: unifieddim.h:127
Boole operator!=(const UnifiedDim &Other) const
Inequality comparison operator.
Definition: unifieddim.h:235
UnifiedDim & operator+=(const UnifiedDim &Other)
Addition assignment operator.
Definition: unifieddim.h:150
void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
Definition: unifieddim.h:258
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
Definition: unifieddim.h:880
UnifiedVec2(const Real &Xrel, const Real &Yrel, const Real &Xabs, const Real &Yabs)
Real constructor.
Definition: unifieddim.h:341
This class represents a box shaped area on the screen.
Definition: rect.h:55
UnifiedDim(const UnifiedDim &Other)
Copy constructor.
Definition: unifieddim.h:83
UnifiedDim operator*(const UnifiedDim &Other) const
Multiplication operator.
Definition: unifieddim.h:134
UnifiedRect(const Real &PositionXrel, const Real &PositionYrel, const Real &SizeXrel, const Real &SizeYrel, const Real &PositionXabs, const Real &PositionYabs, const Real &SizeXabs, const Real &SizeYabs)
Real constructor.
Definition: unifieddim.h:715
UnifiedVec2 & operator-=(const UnifiedVec2 &Other)
Subtraction assignment operator.
Definition: unifieddim.h:435
Real Abs
The absolute value on this dimension.
Definition: unifieddim.h:65
Vector2 CalculateActualDimensions(const Vector2 &Actual) const
Calculates the actual values when a Vector2 with actual dimensions has this unified vector2 applied t...
Definition: unifieddim.h:384
UnifiedVec2(const UnifiedVec2 &Other)
Copy constructor.
Definition: unifieddim.h:348
static String GetSerializableName()
Get the name of the the XML tag the Renderable class will leave behind as its instances are serialize...
Definition: unifieddim.h:294
UnifiedVec2(const Real &x, const Real &y)
Real constructor.
Definition: unifieddim.h:329
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
UnifiedVec2 & operator/=(const UnifiedDim &Other)
Division assignment with UnifiedDim operator.
Definition: unifieddim.h:523
UnifiedVec2 operator*(const UnifiedDim &Other) const
Multiplication with UnifiedDim operator.
Definition: unifieddim.h:480
bool SetValue(const Char8 *rhs)
Set the value of this.
This class represents a 2D rect which can express the size and position of a renderable on screen...
Definition: unifieddim.h:661
UnifiedVec2 operator+(const UnifiedDim &Other) const
Addition with UnifiedDim operator.
Definition: unifieddim.h:466
UnifiedVec2 & operator=(const UnifiedVec2 &Other)
Assignment operator.
Definition: unifieddim.h:591
Real Y
Coordinate on the Y vector.
Definition: vector2.h:69
Boole operator==(const UnifiedRect &Other) const
Equality comparison operator.
Definition: unifieddim.h:784
UnifiedDim()
Class constructor.
Definition: unifieddim.h:71
UnifiedDim(const Real &Relative, const Real &Absolute)
Descriptive constructor.
Definition: unifieddim.h:79
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
Real X
Coordinate on the X vector.
Definition: vector2.h:67
UnifiedVec2 Position
The top left position of this rect.
Definition: unifieddim.h:668
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
Definition: unifieddim.h:603
UnifiedVec2 & operator+=(const UnifiedVec2 &Other)
Addition assignment operator.
Definition: unifieddim.h:426
This is used to represent a point on a 2 dimentional area, such as a screen.
Definition: vector2.h:63
bool Empty() const
Is this storing anything at all?
UnifiedVec2 operator*(const Real &Other)
Multiplication with Real operator.
Definition: unifieddim.h:536
Boole operator!=(const UnifiedVec2 &Other) const
Inequality comparison operator.
Definition: unifieddim.h:580
void SetValues(const Real &Relative, const Real &Absolute)
Sets the values of this dimension.
Definition: unifieddim.h:94
UnifiedDim & operator*=(const Real &Other)
Multiplication assignment with Real operator.
Definition: unifieddim.h:206
UnifiedDim & operator/=(const UnifiedDim &Other)
Division assignment operator.
Definition: unifieddim.h:177
UnifiedDim Y
The dimension on the Y plane.
Definition: unifieddim.h:315
UnifiedDim operator+(const UnifiedDim &Other) const
Addition operator.
Definition: unifieddim.h:120
UnifiedVec2 & operator/=(const UnifiedVec2 &Other)
Division assignment operator.
Definition: unifieddim.h:453
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
UnifiedVec2 & operator/=(const Real &Other)
Division assignment with Real operator.
Definition: unifieddim.h:560
UnifiedDim & operator=(const UnifiedDim &Other)
Assignment operator.
Definition: unifieddim.h:246
UnifiedVec2 operator+(const UnifiedVec2 &Other) const
Addition operator.
Definition: unifieddim.h:396
UnifiedDim operator*(const Real &Other)
Multiplication with Real operator.
Definition: unifieddim.h:190
void SetIdentity()
Sets all members of this unified vector to zero.
Definition: unifieddim.h:375
void SetValues(const Real &PositionXrel, const Real &PositionYrel, const Real &SizeXrel, const Real &SizeYrel, const Real &PositionXabs, const Real &PositionYabs, const Real &SizeXabs, const Real &SizeYabs)
Sets all data members of this unified rect explicitly.
Definition: unifieddim.h:754
Boole operator==(const UnifiedVec2 &Other) const
Equality comparison operator.
Definition: unifieddim.h:573
~UnifiedDim()
Class destructor.
Definition: unifieddim.h:86
This class represents both the relative and absolute values that can be expressed for the values on o...
Definition: unifieddim.h:56
UnifiedVec2()
Class constructor.
Definition: unifieddim.h:321
UnifiedVec2 & operator*=(const UnifiedDim &Other)
Multiplication assignment with UnifiedDim operator.
Definition: unifieddim.h:514
void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Definition: unifieddim.h:620
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
UnifiedRect & operator=(const UnifiedRect &Other)
Assignment operator.
Definition: unifieddim.h:802
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
~UnifiedVec2()
Class destructor.
Definition: unifieddim.h:351
Rect CalculateActualDimensions(const Rect &Actual, Boole AsChild=true) const
Calculates the actual values when a Rect with actual dimensions has this unified rect applied to it...
Definition: unifieddim.h:771
UnifiedDim & operator*=(const UnifiedDim &Other)
Multiplication assignment operator.
Definition: unifieddim.h:168
This class represents a point in 2D space using UnifiedDim's.
Definition: unifieddim.h:306
UnifiedVec2 operator-(const UnifiedDim &Other) const
Subtraction with UnifiedDim operator.
Definition: unifieddim.h:473
UnifiedRect(const UnifiedDim &PositionX, const UnifiedDim &PositionY, const UnifiedDim &SizeX, const UnifiedDim &SizeY)
UnifiedDim constructor.
Definition: unifieddim.h:691
void SetValues(const Real &Xrel, const Real &Yrel, const Real &Xabs, const Real &Yabs)
Sets all data members of this unified vector explicitly.
Definition: unifieddim.h:369
UnifiedVec2 operator*(const UnifiedVec2 &Other) const
Multiplication operator.
Definition: unifieddim.h:410
const Char8 * Name() const
ptrdiff_tGet the name of this Node.
Boole operator==(const UnifiedDim &Other) const
Equality comparison operator.
Definition: unifieddim.h:228
void SetValues(const UnifiedDim &x, const UnifiedDim &y)
Sets all data members of this unified vector explicitly.
Definition: unifieddim.h:359
Vector2 Position
Vector2 representing the top-left position of the rect.
Definition: rect.h:69
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
UnifiedRect()
Class constructor.
Definition: unifieddim.h:676
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
~UnifiedRect()
Class destructor.
Definition: unifieddim.h:722
Real CalculateActualDimension(const Real &Actual) const
Calculates the actual value when a Real in pixels has this unified dim applied to it...
Definition: unifieddim.h:109
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
void SetIdentity()
Sets all members of this unified rect to zero.
Definition: unifieddim.h:761
UnifiedDim operator/(const UnifiedDim &Other) const
Division operator.
Definition: unifieddim.h:141
void SetValues(const UnifiedDim &PositionX, const UnifiedDim &PositionY, const UnifiedDim &SizeX, const UnifiedDim &SizeY)
Sets all data members of this unified rect explicitly.
Definition: unifieddim.h:740
void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Definition: unifieddim.h:273
UnifiedVec2(const UnifiedDim &x, const UnifiedDim &y)
UnifiedDim constructor.
Definition: unifieddim.h:334
UnifiedVec2 operator/(const UnifiedDim &Other) const
Division with UnifiedDim operator.
Definition: unifieddim.h:487