JugiMap Framework
jmCommon.h
1 #ifndef JUGIMAP_COMMON_H
2 #define JUGIMAP_COMMON_H
3 
4 #include <assert.h>
5 #include <algorithm>
6 #include <cmath>
7 #include <vector>
8 #include <string>
9 
10 
11 
12 namespace jugimap {
13 
14 
15 
18 
19 
20 
22 template< typename T>
23 struct Vec2
24 {
25  T x;
26  T y;
27 
28 
30  Vec2(): x(0),y(0){}
31 
33  Vec2(T _x, T _y) : x(_x),y(_y){}
34 
36  inline void Set(T _x, T _y){ x = _x; y = _y;}
37 
39  inline bool operator==(const Vec2<T> &v) const { return(x==v.x && y==v.y);}
40 
42  inline bool operator!=(const Vec2<T> &v) const { return !(*this==v);}
43 
46  inline bool Equals(const Vec2<T> &v, float epsilon = 0.00001f) const { return(x==v.x && y==v.y); }
47 
49  inline Vec2<T> operator-() const { return Vec2<T>(-x,-y); }
50 
52  inline Vec2<T> operator*(const Vec2<T>&v) const { return Vec2<T>(x*v.x,y*v.y);}
53 
55  inline Vec2<T> operator/(const Vec2<T>&v) const { return Vec2<T>(x/v.x,y/v.y);}
56 
58  inline Vec2<T> operator+(const Vec2<T>&v) const { return Vec2<T>(x+v.x,y+v.y);}
59 
61  inline Vec2<T> operator-(const Vec2<T>&v) const { return Vec2<T>(x-v.x,y-v.y);}
62 
64  inline Vec2<T>& operator+=(const Vec2<T>&v)
65  {
66  x += v.x;
67  y += v.y;
68  return *this;
69  }
70 
72  inline Vec2<T>& operator-=(const Vec2<T>&v)
73  {
74  x -= v.x;
75  y -= v.y;
76  return *this;
77  }
78 
80  inline Vec2<T>& operator*=(const Vec2<T>&v)
81  {
82  x *= v.x;
83  y *= v.y;
84  return *this;
85  }
86 
88  inline Vec2<T>& operator/=(const Vec2<T>&v)
89  {
90  x /= v.x;
91  y /= v.y;
92  return *this;
93  }
94 
96  inline Vec2<T>& operator+=(T s)
97  {
98  x += s;
99  y += s;
100  return *this;
101  }
102 
104  inline Vec2<T>& operator-=(T s)
105  {
106  x -= s;
107  y -= s;
108  return *this;
109  }
110 
112  inline Vec2<T>& operator*=(T s)
113  {
114  x *= s;
115  y *= s;
116  return *this;
117  }
118 
120  inline Vec2<T>& operator/=(T s)
121  {
122  x /= s;
123  y /= s;
124  return *this;
125  }
126 
128  inline Vec2<T> operator*(double s) const { return Vec2<T>(x*s,y*s);}
129 
131  inline Vec2<T> operator/(double s) const { return Vec2<T>(x/s,y/s);}
132 
134  inline Vec2<T> operator+(T s) const { return Vec2<T>(x+s,y+s);}
135 
137  inline Vec2<T> operator-(T s) const { return Vec2<T>(x-s,y-s);}
138 
140  inline double GetLength() const { return std::sqrt(x*x+y*y);}
141 
143  inline double GetLength2() const { return x*x+y*y;}
144 
146  inline double Distance(const Vec2<T>&v) const { return (v-*this).GetLength();}
147 
149  inline double Distance2(const Vec2<T>&v) const { return (v-*this).GetLength2();}
150 
152  inline Vec2<T> Normalize() const { return *this/GetLength();}
153 
155  inline T Dot(const Vec2<T> &v) const { return x*v.x+y*v.y;}
156 
157 };
158 
159 
160 template<>
161 inline bool Vec2<float>::Equals(const Vec2<float>&v, float epsilon) const
162 {
163  return fabs(x - v.x)<epsilon && fabs(y - v.y)<epsilon ;
164 }
165 
166 typedef Vec2<int> Vec2i;
168 
169 
170 
171 
173 template<typename T>
174 struct Rect
175 {
176 
179 
180 
182  Rect(){}
183 
185  Rect( T xMin, T yMin, T xMax, T yMax) { min = Vec2<T>( xMin,yMin ); max = Vec2<T>( xMax,yMax ); }
186 
188  Rect(const Vec2<T> &_min, const Vec2<T> &_max){ min = _min; max = _max; }
189 
191  bool operator==(const Rect<T> &r) const { return(min==r.min && max==r.max); }
192 
194  bool operator!=(const Rect<T> &r) const { return !(*this==r); }
195 
198  inline bool Equals(const Rect<T> &r, float epsilon = 0.00001f) const { return(min==r.min && max==r.max); }
199 
201  inline T GetWidth() const { return max.x-min.x; }
202 
204  inline T GetHeight() const { return max.y-min.y; }
205 
207  Rect<T> Unite(const Rect<T> &r) const
208  {
209  T x0 = std::min<T>( min.x, r.min.x );
210  T y0 = std::min<T>( min.y, r.min.y );
211  T x1 = std::max<T>( max.x, r.max.x );
212  T y1 = std::max<T>( max.y, r.max.y );
213  return Rect<T>( x0,y0,x1,y1 );
214  }
215 
217  Rect<T> Expand(const Vec2<T> &v) const
218  {
219  T x0 = std::min<T>( min.x, v.x );
220  T y0 = std::min<T>( min.y, v.y );
221  T x1 = std::max<T>( max.x, v.x );
222  T y1 = std::max<T>( max.y, v.y );
223  return Rect<T>( x0,y0,x1,y1 );
224  }
225 
227  inline Vec2<T> GetSize() const { return max-min;}
228 
230  Vec2<T> GetCenter() const {return (min+max)/2;}
231 
233  inline bool IsEmpty(){return (max.x==min.x || max.y==min.y);}
234 
236  inline bool IsValid(){return (max.x>=min.x || max.y>=min.y);}
237 
239  inline bool Contains(const Vec2<T> &v) const { return v.x>=min.x && v.x<max.x && v.y>=min.y && v.y<max.y; }
240 
242  inline bool Contains(const Rect<T> &r) const { return min.x<=r.min.x && max.x>=r.max.x && min.y<=r.min.y && max.y>=r.max.y;}
243 
245  inline bool Intersects(const Rect<T> &r) const {return r.max.x>min.x && r.min.x<max.x && r.max.y>min.y && r.min.y<max.y;}
246 
247 };
248 
249 
250 template<>
251 inline bool Rect<float>::Equals(const Rect<float>&r, float epsilon) const
252 {
253  return min.Equals(r.min, epsilon) && max.Equals(r.max, epsilon);
254 }
255 
256 typedef Rect<int> Recti;
258 
259 
260 
262 template<typename T>
264 {
265 
269 
271  AffineMat3(){i.x=1; j.y=1;}
272 
274  AffineMat3(const Vec2<T> &_i, const Vec2<T> &_j, const Vec2<T> &_t): i(_i),j(_j),t(_t){}
275 
277  AffineMat3(T ix, T iy, T jx, T jy, T tx, T ty){ i.x=ix; i.y=iy; j.x=jx; j.y=jy; t.x=tx; t.y=ty; }
278 
279 
281  inline AffineMat3<T> Invert() const
282  {
283  float idet = 1.0/(i.x*j.y-i.y*j.x);
284  return AffineMat3<T>(
285  j.y*idet , -i.y*idet,
286  -j.x*idet , i.x*idet,
287  (j.x*t.y-j.y*t.x)*idet , (i.y*t.x-i.x*t.y)*idet );
288  }
289 
291  Vec2<T> operator*(const Vec2<T> &v) const
292  {
293  return Vec2<T>( i.x*v.x + j.x*v.y + t.x , i.y*v.x + j.y*v.y + t.y );
294  }
295 
297  inline AffineMat3<T> operator*(const AffineMat3<T> &m ) const
298  {
299  return AffineMat3<T>(
300  i.x*m.i.x + j.x*m.i.y , i.y*m.i.x + j.y*m.i.y ,
301  i.x*m.j.x + j.x*m.j.y , i.y*m.j.x + j.y*m.j.y ,
302  i.x*m.t.x + j.x*m.t.y + t.x , i.y*m.t.x + j.y*m.t.y + t.y );
303  }
304 
306  inline Vec2<T> Transform(const Vec2<T> &v) const
307  {
308  return Vec2<T>( i.x*v.x + j.x*v.y + t.x , i.y*v.x + j.y*v.y + t.y );
309  }
310 
311 
313  inline Vec2<T> Transform(T x, T y) const
314  {
315  return Vec2<T>( i.x*x + j.x*y + t.x , i.y*x + j.y*y + t.y );
316  }
317 
318 
320  inline AffineMat3<T> Transform(float ix, float iy, float jx, float jy, float tx, float ty) const
321  {
322  return AffineMat3<T>(
323  i.x*ix + j.x*iy , i.y*ix + j.y*iy ,
324  i.x*jx + j.x*jy , i.y*jx + j.y*jy ,
325  i.x*tx + j.x*ty + t.x , i.y*tx + j.y*ty + t.y );
326  }
327 
328 
330  inline AffineMat3<T> Translate(T tx, T ty) const
331  {
332  return Transform( 1,0,0,1,tx,ty );
333  }
334 
335 
337  inline AffineMat3<T> Translate(const Vec2<T> &tv) const { return Transform( 1,0,0,1,tv.x,tv.y );}
338 
340  inline AffineMat3<T> Rotate(double rz) const { return Transform( std::cos( rz ),-std::sin( rz ), std::sin( rz ), std::cos( rz ),0,0 );}
341 
343  inline AffineMat3<T> Scale(T sx, T sy) const { return Transform( sx,0,0,sy,0,0 );}
344 
346  inline AffineMat3<T> Scale(const Vec2<T> &sv) const { return Transform( sv.x,0,0,sv.y,0,0 );}
347 
349  AffineMat3<T> static Translation(T tx, T ty){ return AffineMat3<T>( 1,0,0,1,tx,ty ); }
350 
352  AffineMat3<T> static Translation(const Vec2<T> &tv){ return AffineMat3<T>( 1,0,0,1,tv.x,tv.y );}
353 
355  AffineMat3<T> static Rotation(double rz){ return AffineMat3<T>( std::cos( rz ),-std::sin( rz ), std::sin( rz ), std::cos( rz ),0,0 ); }
356 
358  AffineMat3<T> static Scaling(T sx, T sy){ return AffineMat3<T>( sx,0,0,sy,0,0 ); }
359 
361  AffineMat3<T> static Scaling(const Vec2<T> &sv){ return AffineMat3<T>( sv.x,0,0,sv.y,0,0 );}
362 
363 
365  AffineMat3<T> static Ortho(T left, T right, T bottom, T top)
366  {
367 
368  T w = right-left;
369  T h = top-bottom;
370 
371  AffineMat3<T> r;
372  r.i.x=2/w;
373  r.j.y=2/h;
374  r.t.x=-(right+left)/w;
375  r.t.y=-(top+bottom)/h;
376  return r;
377  }
378 
379 };
380 
382 
383 
384 
385 
386 //================================================================================================================================
387 
388 
392 struct Parameter
393 {
394  std::string name;
395  std::string value;
396  int kind = -1;
397 
398 
401  static bool Exists(const std::vector<Parameter> &parameters, const std::string &name, const std::string &value="");
402 
404  static std::string GetValue(const std::vector<Parameter> &parameters, const std::string &name, const std::string &defaultValue="");
405 
407  static int GetIntValue(const std::vector<Parameter> &parameters, const std::string &name, int defaultValue=0);
408 
410  static float GetFloatValue(const std::vector<Parameter> &parameters, const std::string &name, float defaultValue=0.0);
411 
412 
413  static Parameter Parse(const std::string &s);
414 
415 };
416 
417 
418 
419 //================================================================================================================================
420 
421 
424 class Easing
425 {
426 public:
427 
429  enum class Kind : int
430  {
431  LINEAR = 0,
432  EASE_START = 1,
433  EASE_END = 2,
434  EASE_START_END = 3,
435  CONSTANT = 4
436  };
437 
438 
440  float GetValue(float p);
441 
442  Kind kind = Kind::LINEAR;
443 
444 };
445 
446 
447 //================================================================================================================================
448 
449 
451 class Tween
452 {
453 public:
454  friend class Tweens;
455 
457  enum class Mode
458  {
459  NORMAL,
460  REVERSE,
461  LOOP,
462  LOOP_REVERSE
463  };
464 
465  //~Tween();
466 
467 
474  void Init(float _valueStart, float _valueEnd, float _durationS, Easing::Kind _easingKind);
475 
476 
478  void Play();
479 
480 
484  float Update();
485 
486 
488  bool IsIdle() { return state==stateIDLE || state == stateNEVER_INITIALIZED; }
489 
490 
492  void Stop();
493 
494 
498  void Pause();
499 
500 
504  void Resume();
505 
506 
508  void SetEasingKind(Easing::Kind _kind) { easing.kind = _kind; }
509 
510 
512  void SetMode(Mode _mode) { mode = _mode;}
513 
514 
516  float GetStartValue(){ return valueStart;}
517 
518 
520  float GetEndValue(){ return valueEnd;}
521 
522 
523 
524 
525 private:
526  float value = 0;
527  float valueStart = 0.0;
528  float valueEnd = 0.0;
529  int timeStartMS = 0;
530  int timeEndMS = 0;
531  int durationMS = 0;
532  Easing easing;
533 
534  int state = stateNEVER_INITIALIZED;
535  static const int stateNEVER_INITIALIZED = -1;
536  static const int stateIDLE = 0;
537  static const int statePLAYING = 1;
538  static const int statePAUSED = 3;
539 
540 
541  Mode mode = Mode::NORMAL;
542  bool reverse = false;
543 
544  int stateStored = 0;
545  int msTimeStored = 0;
546 
547 
548 };
549 
550 
551 //================================================================================================================================
552 
553 
556 {
557 public:
558 
559  virtual ~CustomObject(){}
560 
561  virtual std::string GetInfo(){ return ""; }
562 
563 
565  void SetTag(int _tag){ tag = _tag; }
566 
568  int GetTag(){ return tag; }
569 
570 
571 private:
572  int tag = 0;
573 
574 };
575 
576 
577 
579 
580 }
581 
582 
583 
584 
585 #endif
586 
587 
jugimap::AffineMat3::Translate
AffineMat3< T > Translate(T tx, T ty) const
Returns a matrix formed by translating this matrix by the given vector coordinates tx and ty.
Definition: jmCommon.h:330
jugimap::AffineMat3f
AffineMat3< float > AffineMat3f
AffineMat3 struct in float precision.
Definition: jmCommon.h:381
jugimap::CustomObject
The CustomObject class is the base class for custom objects.
Definition: jmCommon.h:555
jugimap::Rect::Contains
bool Contains(const Vec2< T > &v) const
Returns true if the given vector point v is inside this rectangle; otherwise returns false.
Definition: jmCommon.h:239
jugimap::Rect::Intersects
bool Intersects(const Rect< T > &r) const
Returns true if the given rectangle r is intersects this rectangle; otherwise returns false.
Definition: jmCommon.h:245
jugimap::Vec2::operator-
Vec2< T > operator-(T s) const
Returns a vector object formed by subtracting the given s from this vector.
Definition: jmCommon.h:137
jugimap::Vec2::operator/=
Vec2< T > & operator/=(T s)
Divides this vector with the given s and return a reference to this vector.
Definition: jmCommon.h:120
jugimap::Rect
Rectangle.
Definition: jmCommon.h:174
jugimap::Vec2::Normalize
Vec2< T > Normalize() const
Returns a vector object formed by normalizing this vector.
Definition: jmCommon.h:152
jugimap::AffineMat3::Scale
AffineMat3< T > Scale(T sx, T sy) const
Returns a matrix formed by scaling this matrix by the given vector components sx and sy.
Definition: jmCommon.h:343
jugimap::Parameter::name
std::string name
The name of this parameter.
Definition: jmCommon.h:394
jugimap::AffineMat3::AffineMat3
AffineMat3(T ix, T iy, T jx, T jy, T tx, T ty)
Constructs a matrix from the given row vector components ix, iy, jx, jy, tx and ty.
Definition: jmCommon.h:277
jugimap::Parameter::value
std::string value
The value of this parameter.
Definition: jmCommon.h:395
jugimap::Vec2::operator==
bool operator==(const Vec2< T > &v) const
Returns true if this vector is equal to given vector v; otherwise returns false.
Definition: jmCommon.h:39
jugimap::Vec2::Vec2
Vec2()
Constructs a vector with coordinates (0,0).
Definition: jmCommon.h:30
jugimap::Vec2::Distance2
double Distance2(const Vec2< T > &v) const
Returns the square distance from the given vector v.
Definition: jmCommon.h:149
jugimap::Tween::Mode
Mode
The tween mode.
Definition: jmCommon.h:457
jugimap::Rect::Rect
Rect()
Constructs an empty 'null' rectangle.
Definition: jmCommon.h:182
jugimap::Vec2i
Vec2< int > Vec2i
Vec2 struct in integer precision.
Definition: jmCommon.h:166
jugimap::Vec2::Distance
double Distance(const Vec2< T > &v) const
Return the distance from the given vector v.
Definition: jmCommon.h:146
jugimap::Tween::IsIdle
bool IsIdle()
Returns true if this tween is not running; otherwise return false.
Definition: jmCommon.h:488
jugimap::ColorOverlayBlend::NORMAL
Normal mode.
jugimap::Tween::GetEndValue
float GetEndValue()
Returns the end value of this tween;.
Definition: jmCommon.h:520
jugimap::AffineMat3::Rotate
AffineMat3< T > Rotate(double rz) const
Returns a matrix formed by rotating this matrix by the given angle rz; the angle is in radians.
Definition: jmCommon.h:340
jugimap::Vec2::operator*=
Vec2< T > & operator*=(T s)
Multiplies this vector with the given s and return a reference to this vector.
Definition: jmCommon.h:112
jugimap::Vec2::Dot
T Dot(const Vec2< T > &v) const
Returns the dot product of this vector and the given vector v.
Definition: jmCommon.h:155
jugimap::AffineMat3::j
Vec2< T > j
The second row of the matrix.
Definition: jmCommon.h:267
jugimap::Rect::IsValid
bool IsValid()
Returns true if the maximum coordinate is bigger or equal to the minimum coordinate; otherwise return...
Definition: jmCommon.h:236
jugimap::Vec2::operator-=
Vec2< T > & operator-=(const Vec2< T > &v)
Subtracts the given vector v from this vector and return a reference to this vector.
Definition: jmCommon.h:72
jugimap::Vec2::operator-=
Vec2< T > & operator-=(T s)
Subtracts the given s from this vector and return a reference to this vector.
Definition: jmCommon.h:104
jugimap::Vec2::operator*
Vec2< T > operator*(const Vec2< T > &v) const
Returns a vector object formed by multiplying this vector with the given vector v.
Definition: jmCommon.h:52
jugimap::AffineMat3::operator*
Vec2< T > operator*(const Vec2< T > &v) const
Returns a matrix formed by multiplying this matrix with the given vector v.
Definition: jmCommon.h:291
jugimap::Rect::Rect
Rect(const Vec2< T > &_min, const Vec2< T > &_max)
Constructs a rectangle from the given minimum and maximum vectors .
Definition: jmCommon.h:188
jugimap::Rect::Expand
Rect< T > Expand(const Vec2< T > &v) const
Returns a rectangle formed by expanding this rectangle by the given vector v.
Definition: jmCommon.h:217
jugimap::AffineMat3::AffineMat3
AffineMat3(const Vec2< T > &_i, const Vec2< T > &_j, const Vec2< T > &_t)
Constructs a matrix from the given row vectors **_i**, **_j** and **_t**.
Definition: jmCommon.h:274
jugimap::AffineMat3::t
Vec2< T > t
The third row of the matrix.
Definition: jmCommon.h:268
jugimap::Rect::max
Vec2< T > max
The maximum coordinate (the right-bottom corner when y coordinate points downward).
Definition: jmCommon.h:178
jugimap::Vec2::operator*=
Vec2< T > & operator*=(const Vec2< T > &v)
Multiplyes this vector with the given vector v and return a reference to this vector.
Definition: jmCommon.h:80
jugimap::Parameter
The Parameter struct defines a pair name : value.
Definition: jmCommon.h:392
jugimap::Vec2::x
T x
The x coordinate.
Definition: jmCommon.h:25
jugimap::Vec2::operator/=
Vec2< T > & operator/=(const Vec2< T > &v)
Divides this vector with the given vector v and return a reference to this vector.
Definition: jmCommon.h:88
jugimap::Tween
The Tween class defines transition between two values over time.
Definition: jmCommon.h:451
jugimap::AffineMat3::Invert
AffineMat3< T > Invert() const
Returns a matrix formed by inverting this matrix.
Definition: jmCommon.h:281
jugimap::AffineMat3::i
Vec2< T > i
The first row of the matrix.
Definition: jmCommon.h:266
jugimap::Vec2::operator-
Vec2< T > operator-() const
Return a vector object formed by changing the sign of this vector components.
Definition: jmCommon.h:49
jugimap::CustomObject::SetTag
void SetTag(int _tag)
Set the tag of this custom object.
Definition: jmCommon.h:565
jugimap::Tween::GetStartValue
float GetStartValue()
Returns the starting value of this tween;.
Definition: jmCommon.h:516
jugimap::AffineMat3::Scale
AffineMat3< T > Scale(const Vec2< T > &sv) const
Returns a matrix formed by scaling this matrix by the given vector sv.
Definition: jmCommon.h:346
jugimap::AffineMat3::AffineMat3
AffineMat3()
Constructs an identity matrix.
Definition: jmCommon.h:271
jugimap::Recti
Rect< int > Recti
Rect struct in integer precision.
Definition: jmCommon.h:256
jugimap::Rect::operator==
bool operator==(const Rect< T > &r) const
Returns true if this rectangle is equal to the given rectangle r; otherwise returns false.
Definition: jmCommon.h:191
jugimap::Rect::Equals
bool Equals(const Rect< T > &r, float epsilon=0.00001f) const
Definition: jmCommon.h:198
jugimap::Tween::SetEasingKind
void SetEasingKind(Easing::Kind _kind)
Set the easing kind of this tween.
Definition: jmCommon.h:508
jugimap::Rect::min
Vec2< T > min
The minimum coordinate (the left-top corner when y coordinate points downward).
Definition: jmCommon.h:177
jugimap::AffineMat3::Translation
static AffineMat3< T > Translation(const Vec2< T > &tv)
Creates a matrix representing a translation by the given vector tv.
Definition: jmCommon.h:352
jugimap::AffineMat3::Translation
static AffineMat3< T > Translation(T tx, T ty)
Creates a matrix representing a translation by the given vector coordinates tx and ty.
Definition: jmCommon.h:349
jugimap::Vec2::operator!=
bool operator!=(const Vec2< T > &v) const
Returns true if this vector is not equal to given vector v; otherwise returns false.
Definition: jmCommon.h:42
jugimap::Vec2::operator*
Vec2< T > operator*(double s) const
Returns a vector object formed by multiplying this vector with the given s.
Definition: jmCommon.h:128
jugimap::AffineMat3::Scaling
static AffineMat3< T > Scaling(T sx, T sy)
Creates a matrix representing a scaling by the given vector components sx and sy.
Definition: jmCommon.h:358
jugimap::Tween::SetMode
void SetMode(Mode _mode)
Set the mode of this tween.
Definition: jmCommon.h:512
jugimap::Vec2::Equals
bool Equals(const Vec2< T > &v, float epsilon=0.00001f) const
Returns true if the given vectors v is equal to this vector; otherwise returns false....
Definition: jmCommon.h:46
jugimap::Vec2::y
T y
The y coordinate.
Definition: jmCommon.h:26
jugimap::Vec2::Set
void Set(T _x, T _y)
Sets the coordinates of this vector to the given **_x** and **_y**.
Definition: jmCommon.h:36
jugimap::Rectf
Rect< float > Rectf
Rect struct in float precision.
Definition: jmCommon.h:257
jugimap::Rect::GetHeight
T GetHeight() const
Returns the height of this rectangle.
Definition: jmCommon.h:204
jugimap::Vec2f
Vec2< float > Vec2f
Vec2 struct in float precision.
Definition: jmCommon.h:167
jugimap::Vec2::GetLength
double GetLength() const
Returns the length of this vector.
Definition: jmCommon.h:140
jugimap::AffineMat3::Scaling
static AffineMat3< T > Scaling(const Vec2< T > &sv)
Creates a matrix representing a scaling by the given vector sv.
Definition: jmCommon.h:361
jugimap::Vec2::operator+=
Vec2< T > & operator+=(T s)
Adds the given s to this vector and return a reference to this vector.
Definition: jmCommon.h:96
jugimap::Easing::Kind
Kind
The kind of Easing.
Definition: jmCommon.h:429
jugimap::Rect::Contains
bool Contains(const Rect< T > &r) const
Returns true if the given rectangle r is inside this rectangle; otherwise returns false.
Definition: jmCommon.h:242
jugimap::Vec2::operator+
Vec2< T > operator+(T s) const
Returns a vector object formed by adding the given s to this vector.
Definition: jmCommon.h:134
jugimap::Rect::Unite
Rect< T > Unite(const Rect< T > &r) const
Returns a rectangle formed by uniting this rectangle with the given rectangle r.
Definition: jmCommon.h:207
jugimap::AffineMat3::Translate
AffineMat3< T > Translate(const Vec2< T > &tv) const
Returns a matrix formed by translating this matrix by the given vector tv.
Definition: jmCommon.h:337
jugimap::Vec2::Vec2
Vec2(T _x, T _y)
Constructs a vector with the given coordinates **_x** and **_y**.
Definition: jmCommon.h:33
jugimap::Vec2::operator+=
Vec2< T > & operator+=(const Vec2< T > &v)
Adds the given vector v to this vector and return a reference to this vector.
Definition: jmCommon.h:64
jugimap::Rect::GetWidth
T GetWidth() const
Returns the width of this rectangle.
Definition: jmCommon.h:201
jugimap::Rect::GetSize
Vec2< T > GetSize() const
Returns a vector storing the size of this rectangle; the width is stored in x and the height is store...
Definition: jmCommon.h:227
jugimap::AffineMat3::operator*
AffineMat3< T > operator*(const AffineMat3< T > &m) const
Returns a matrix formed by multiplying this matrix with the given matrix m.
Definition: jmCommon.h:297
jugimap::Rect::IsEmpty
bool IsEmpty()
Returns true if the minimum and maximum coordinates are equal; otherwise returns false.
Definition: jmCommon.h:233
jugimap::AffineMat3::Transform
Vec2< T > Transform(const Vec2< T > &v) const
Returns a vector formed by multiplying the given vector v with this matrix.
Definition: jmCommon.h:306
jugimap::Rect::Rect
Rect(T xMin, T yMin, T xMax, T yMax)
Constructs a rectangle from the given minimum and maximum coordinates.
Definition: jmCommon.h:185
jugimap::Vec2::operator/
Vec2< T > operator/(const Vec2< T > &v) const
Returns a vector object formed by dividing this vector with the given vector v.
Definition: jmCommon.h:55
jugimap::AffineMat3
Matrix representation of the affine transformation.
Definition: jmCommon.h:263
jugimap::CustomObject::GetTag
int GetTag()
Returns the tag of this custom object.
Definition: jmCommon.h:568
jugimap::AffineMat3::Ortho
static AffineMat3< T > Ortho(T left, T right, T bottom, T top)
Creates a matrix representing an orthographic projection.
Definition: jmCommon.h:365
jugimap::KeyCode::T
T.
jugimap::Vec2::operator+
Vec2< T > operator+(const Vec2< T > &v) const
Returns a vector object formed as the sum of the given s to this vector.
Definition: jmCommon.h:58
jugimap::Rect::GetCenter
Vec2< T > GetCenter() const
Returns a vector storing the center point of this rectangle.
Definition: jmCommon.h:230
jugimap::Vec2
2d vector.
Definition: jmCommon.h:23
jugimap::AffineMat3::Transform
Vec2< T > Transform(T x, T y) const
Returns a vector formed by multiplying the given coordinate x,y with this matrix.
Definition: jmCommon.h:313
jugimap::Vec2::operator-
Vec2< T > operator-(const Vec2< T > &v) const
Returns a vector object formed by subtracting the given v from this vector.
Definition: jmCommon.h:61
jugimap::Vec2::GetLength2
double GetLength2() const
Returns the square length of this vector.
Definition: jmCommon.h:143
jugimap::Vec2::operator/
Vec2< T > operator/(double s) const
Returns a vector object formed by dividing this vector with the given s.
Definition: jmCommon.h:131
jugimap::Rect::operator!=
bool operator!=(const Rect< T > &r) const
Returns true if this rectangle is not equal to the given rectangle r; otherwise returns false.
Definition: jmCommon.h:194
jugimap::AffineMat3::Transform
AffineMat3< T > Transform(float ix, float iy, float jx, float jy, float tx, float ty) const
Returns a matrix formed by multiplying this matrix with the given matrix components ix,...
Definition: jmCommon.h:320
jugimap::Easing
The Easing struct defines interpolation methods used for obtaining values between a start value and a...
Definition: jmCommon.h:424
jugimap::AffineMat3::Rotation
static AffineMat3< T > Rotation(double rz)
Creates a matrix representing a rotation by the given angle rz; the angle is in radians.
Definition: jmCommon.h:355