TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_base_types.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <assert.h>
5#include <algorithm>
6#include <functional>
7
8
9namespace tachyon
10{
13
14 using OnGuiFunc = std::function<void()>;
15
18 struct int2
19 {
20 int32_t x, y;
21
22 inline int32_t& operator[](int index) { assert(index >= 0 && index < 2); return (&x)[index]; }
23 inline const int32_t& operator[](int index) const { assert(index >= 0 && index < 2); return (&x)[index]; }
24 inline bool operator==(const int2& other) const { return x == other.x && y == other.y; }
25 inline bool operator!=(const int2& other) const { return !(*this == other); }
26
27 inline int2 operator-() const { return int2{ -x, -y }; }
28 inline int2 operator+() const { return int2{ x, y }; }
29
30 inline int2 operator- (const int2& other) const { return int2 { x - other.x, y - other.y }; }
31 inline int2 operator+ (const int2& other) const { return int2 { x + other.x, y + other.y }; }
32 inline int2& operator-=(const int2& other) { x -= other.x; y -= other.y; return *this; }
33 inline int2& operator+=(const int2& other) { x += other.x; y += other.y; return *this; }
34 };
35
36 struct int3
37 {
38 int32_t x = 0, y = 0, z = 0;
39
40 inline int32_t& operator[](int index) { assert(index >= 0 && index < 3); return (&x)[index]; }
41 inline const int32_t& operator[](int index) const { assert(index >= 0 && index < 3); return (&x)[index]; }
42 inline bool operator==(const int3& other) const { return x == other.x && y == other.y && z == other.z; }
43 inline bool operator!=(const int3& other) const { return !(*this == other); }
44
45 inline int3 operator-() const { return int3{ -x, -y, -z }; }
46 inline int3 operator+() const { return int3{ x, y, z }; }
47
48 inline int3 operator- (const int3& other) const { return int3 { x - other.x, y - other.y, z - other.z }; }
49 inline int3 operator+ (const int3& other) const { return int3 { x + other.x, y + other.y, z + other.z }; }
50 inline int3& operator-=(const int3& other) { x -= other.x; y -= other.y; z -= other.z; return *this; }
51 inline int3& operator+=(const int3& other) { x += other.x; y += other.y; z += other.z; return *this; }
52 };
53
54 struct int4
55 {
56 int32_t x = 0, y = 0, z = 0, w = 0;
57
58 inline int32_t& operator[](int index) { assert(index >= 0 && index < 4); return (&x)[index]; }
59 inline const int32_t& operator[](int index) const { assert(index >= 0 && index < 4); return (&x)[index]; }
60 inline bool operator==(const int4& other) const { return x == other.x && y == other.y && z == other.z && w == other.w; }
61 inline bool operator!=(const int4& other) const { return !(*this == other); }
62
63 inline int4 operator-() const { return int4{ -x, -y, -z, -w }; }
64 inline int4 operator+() const { return int4{ x, y, z, w }; }
65
66 inline int4 operator- (const int4& other) const { return int4 { x - other.x, y - other.y, z - other.z, w - other.w }; }
67 inline int4 operator+ (const int4& other) const { return int4 { x + other.x, y + other.y, z + other.z, w + other.w }; }
68 inline int4& operator-=(const int4& other) { x -= other.x; y -= other.y; z -= other.z; w -= other.w; return *this; }
69 inline int4& operator+=(const int4& other) { x += other.x; y += other.y; z += other.z; w += other.w; return *this; }
70 };
71
72
73
74 struct uint2
75 {
76 uint32_t x = 0, y = 0;
77
78 inline uint32_t& operator[](int index) { assert(index >= 0 && index < 2); return (&x)[index]; }
79 inline const uint32_t& operator[](int index) const { assert(index >= 0 && index < 2); return (&x)[index]; }
80 inline bool operator==(const uint2& other) const { return x == other.x && y == other.y; }
81 inline bool operator!=(const uint2& other) const { return !(*this == other); }
82
83 inline uint2 operator- (const uint2& other) const { return uint2 { x - other.x, y - other.y }; }
84 inline uint2 operator+ (const uint2& other) const { return uint2 { x + other.x, y + other.y }; }
85 inline uint2& operator-=(const uint2& other) { x -= other.x; y -= other.y; return *this; }
86 inline uint2& operator+=(const uint2& other) { x += other.x; y += other.y; return *this; }
87 };
88
89 struct uint3
90 {
91 uint32_t x = 0, y = 0, z = 0;
92
93 inline uint32_t& operator[](int index) { assert(index >= 0 && index < 3); return (&x)[index]; }
94 inline const uint32_t& operator[](int index) const { assert(index >= 0 && index < 3); return (&x)[index]; }
95 inline bool operator==(const uint3& other) const { return x == other.x && y == other.y && z == other.z; }
96 inline bool operator!=(const uint3& other) const { return !(*this == other); }
97
98 inline uint3 operator- (const uint3& other) const { return uint3 { x - other.x, y - other.y, z - other.z }; }
99 inline uint3 operator+ (const uint3& other) const { return uint3 { x + other.x, y + other.y, z + other.z }; }
100 inline uint3& operator-=(const uint3& other) { x -= other.x; y -= other.y; z -= other.z; return *this; }
101 inline uint3& operator+=(const uint3& other) { x += other.x; y += other.y; z += other.z; return *this; }
102 };
103
104 struct uint4
105 {
106 uint32_t x = 0, y = 0, z = 0, w = 0;
107
108 inline uint32_t& operator[](int index) { assert(index >= 0 && index < 4); return (&x)[index]; }
109 inline const uint32_t& operator[](int index) const { assert(index >= 0 && index < 4); return (&x)[index]; }
110 inline bool operator==(const uint4& other) const { return x == other.x && y == other.y && z == other.z && w == other.w; }
111 inline bool operator!=(const uint4& other) const { return !(*this == other); }
112
113 inline uint4 operator- (const uint4& other) const { return uint4 { x - other.x, y - other.y, z - other.z, w - other.w }; }
114 inline uint4 operator+ (const uint4& other) const { return uint4 { x + other.x, y + other.y, z + other.z, w + other.w }; }
115 inline uint4& operator-=(const uint4& other) { x -= other.x; y -= other.y; z -= other.z; w -= other.w; return *this; }
116 inline uint4& operator+=(const uint4& other) { x += other.x; y += other.y; z += other.z; w += other.w; return *this; }
117 };
118
119
120 struct float2
121 {
122 float x = 0, y = 0;
123
124 inline float& operator[](int index) { assert(index >= 0 && index < 2); return (&x)[index]; }
125 inline const float& operator[](int index) const { assert(index >= 0 && index < 2); return (&x)[index]; }
126
127 inline float2 operator-() const { return float2{ -x, -y }; }
128 inline float2 operator+() const { return float2{ x, y }; }
129
130 inline float2 operator- (const int2& other) const { return float2{ x - other.x, y - other.y }; }
131 inline float2 operator+ (const int2& other) const { return float2{ x + other.x, y + other.y }; }
132 inline float2& operator-=(const int2& other) { x -= other.x; y -= other.y; return *this; }
133 inline float2& operator+=(const int2& other) { x += other.x; y += other.y; return *this; }
134
135 inline float2 operator- (const float2& other) const { return float2{ x - other.x, y - other.y }; }
136 inline float2 operator+ (const float2& other) const { return float2{ x + other.x, y + other.y }; }
137 inline float2& operator-=(const float2& other) { x -= other.x; y -= other.y; return *this; }
138 inline float2& operator+=(const float2& other) { x += other.x; y += other.y; return *this; }
139
140 inline float2 operator* (float other) const { return float2{ x * other, y * other }; }
141 inline float2 operator/ (float other) const { return float2{ x / other, y / other }; }
142 inline float2& operator*=(float other) { x *= other; y *= other; return *this; }
143 inline float2& operator/=(float other) { x /= other; y /= other; return *this; }
144
145 inline bool operator==(const float2& other) const { return x == other.x && y == other.y; }
146 inline bool operator!=(const float2& other) const { return !(*this == other); }
147 };
148
149 struct float3
150 {
151 float x = 0, y = 0, z = 0;
152
153 inline float& operator[](int index) { assert(index >= 0 && index < 3); return (&x)[index]; }
154 inline const float& operator[](int index) const { assert(index >= 0 && index < 3); return (&x)[index]; }
155
156 inline float3 operator-() const { return float3{ -x, -y, -z }; }
157 inline float3 operator+() const { return float3{ x, y, z }; }
158
159 inline float3 operator- (const float3& other) const { return float3{ x - other.x, y - other.y, z - other.z }; }
160 inline float3 operator+ (const float3& other) const { return float3{ x + other.x, y + other.y, z + other.z }; }
161 inline float3& operator-=(const float3& other) { x -= other.x; y -= other.y; z -= other.z; return *this; }
162 inline float3& operator+=(const float3& other) { x += other.x; y += other.y; z += other.z; return *this; }
163
164 inline float3 operator* (float other) const { return float3{ x * other, y * other, z * other }; }
165 inline float3 operator/ (float other) const { return float3{ x / other, y / other, z / other }; }
166 inline float3& operator*=(float other) { x *= other; y *= other; z *= other; return *this; }
167 inline float3& operator/=(float other) { x /= other; y /= other; z /= other; return *this; }
168
169 inline bool operator==(const float3& other) const { return x == other.x && y == other.y && z == other.z; }
170 inline bool operator!=(const float3& other) const { return !(*this == other); }
171 };
172
173 struct float4
174 {
175 float x = 0, y = 0, z = 0, w = 0;
176
177 inline float& operator[](int index) { assert(index >= 0 && index < 4); return (&x)[index]; }
178 inline const float& operator[](int index) const { assert(index >= 0 && index < 4); return (&x)[index]; }
179
180 inline float4 operator-() const { return float4{ -x, -y, -z, -w }; }
181 inline float4 operator+() const { return float4{ x, y, z, w }; }
182
183 inline float4 operator- (const float4& other) const { return float4{ x - other.x, y - other.y, z - other.z, w - other.w }; }
184 inline float4 operator+ (const float4& other) const { return float4{ x + other.x, y + other.y, z + other.z, w + other.w }; }
185 inline float4& operator-=(const float4& other) { x -= other.x; y -= other.y; z -= other.z; w -= other.w; return *this; }
186 inline float4& operator+=(const float4& other) { x += other.x; y += other.y; z += other.z; w += other.w; return *this; }
187
188 inline float4 operator* (float other) const { return float4{ x * other, y * other, z * other, w * other }; }
189 inline float4 operator/ (float other) const { return float4{ x / other, y / other, z / other, w / other }; }
190 inline float4& operator*=(float other) { x *= other; y *= other; z *= other; w *= other; return *this; }
191 inline float4& operator/=(float other) { x /= other; y /= other; z /= other; w /= other; return *this; }
192
193 inline bool operator==(const float4& other) const { return x == other.x && y == other.y && z == other.z && w == other.w; }
194 inline bool operator!=(const float4& other) const { return !(*this == other); }
195
196 inline float4 operator*(float const scale)
197 {
198 return float4{x * scale, y * scale, z * scale, w * scale};
199 }
200 };
201
202 struct float2x2
203 {
204 float2 r0 = float2{1,0}, r1 = float2{0,1};
205
206 inline float2& operator[](int index) { assert(index >= 0 && index < 2); return (&r0)[index]; }
207 inline const float2& operator[](int index) const { assert(index >= 0 && index < 2); return (&r0)[index]; }
208
209 inline bool operator==(const float2x2& other) const { return r0 == other.r0 && r1 == other.r1; }
210 inline bool operator!=(const float2x2& other) const { return !(*this == other); }
211
213 };
214
218 struct float3x2
219 {
220 float3 r0 = float3 { 1,0,0 }, r1 = float3 { 0,1,0 };
221
222 inline float3& operator[](int index) { assert(index >= 0 && index < 2); return (&r0)[index]; }
223 inline const float3& operator[](int index) const { assert(index >= 0 && index < 2); return (&r0)[index]; }
224
225 inline bool operator==(const float3x2& other) const { return r0 == other.r0 && r1 == other.r1; }
226 inline bool operator!=(const float3x2& other) const { return !(*this == other); }
227
228 static constexpr float3x2 Identity() { return float3x2{}; }
229
230 inline bool IsIdentity() const
231 {
232 return r0.x == 1.0f && r0.y == 0.0f && r0.z == 0.0f &&
233 r1.x == 0.0f && r1.y == 1.0f && r1.z == 0.0f;
234 }
235
236 // Compose: apply this transform after b (result = this * b)
237 float3x2 operator*(const float3x2& b) const;
238
239
240 inline static float3x2 Scale(int2 scale) { return { { (float)scale.x, 0, 0 }, { 0, (float)scale.y, 0 } }; }
241 inline static float3x2 Scale(int x, int y) { return { { (float)x, 0, 0 }, { 0, (float)y, 0 } }; }
242 inline static float3x2 Scale(int s) { return { { (float)s, 0, 0 }, { 0, (float)s, 0 } }; }
243 inline static float3x2 Translate(int2 translation) { return { { 1, 0, (float)translation.x }, { 0, 1, (float)translation.y } }; }
244 inline static float3x2 Translate(int x, int y) { return { { 1, 0, (float)x }, { 0, 1, (float)y } }; }
245
246 inline static float3x2 Scale(float2 scale) { return { { scale.x, 0, 0 }, { 0, scale.y, 0 } }; }
247 inline static float3x2 Scale(float x, float y) { return { { x, 0, 0 }, { 0, y, 0 } }; }
248 inline static float3x2 Scale(float s) { return { { s, 0, 0 }, { 0, s, 0 } }; }
249 inline static float3x2 Translate(float2 translation) { return { { 1, 0, translation.x }, { 0, 1, translation.y } }; }
250 inline static float3x2 Translate(float x, float y) { return { { 1, 0, x }, { 0, 1, y } }; }
251
254
256 };
257
258 struct float4x4
259 {
260 float4 r0 = float4{1,0,0,0}, r1 = float4{0,1,0,0}, r2 = float4{0,0,1,0}, r3 = float4{0,0,0,1};
261
262 inline float4& operator[](int index) { assert(index >= 0 && index < 4); return (&r0)[index]; }
263 inline const float4& operator[](int index) const { assert(index >= 0 && index < 4); return (&r0)[index]; }
264
265 inline bool operator==(const float4x4& other) const { return r0 == other.r0 && r1 == other.r1 && r2 == other.r2 && r3 == other.r3; }
266 inline bool operator!=(const float4x4& other) const { return !(*this == other); }
267
268
269 float4x4 operator*(float4x4 const& m2) const;
270 };
271
272
273
274 using byte = unsigned char;
275
276 struct byte2
277 {
278 byte x = 0, y = 0;
279
280 inline byte& operator[](int index) { assert(index >= 0 && index < 2); return (&x)[index]; }
281 inline const byte& operator[](int index) const { assert(index >= 0 && index < 2); return (&x)[index]; }
282
283 inline bool operator==(const byte2& other) const { return x == other.x && y == other.y; }
284 inline bool operator!=(const byte2& other) const { return !(*this == other); }
285 };
286
287 struct byte3
288 {
289 byte x = 0, y = 0, z = 0;
290
291 inline byte& operator[](int index) { assert(index >= 0 && index < 3); return (&x)[index]; }
292 inline const byte& operator[](int index) const { assert(index >= 0 && index < 3); return (&x)[index]; }
293
294 inline bool operator==(const byte3& other) const { return x == other.x && y == other.y && z == other.z; }
295 inline bool operator!=(const byte3& other) const { return !(*this == other); }
296 };
297
298 struct byte4
299 {
300 byte x = 0, y = 0, z = 0, w = 0;
301
302 inline byte& operator[](int index) { assert(index >= 0 && index < 4); return (&x)[index]; }
303 inline const byte& operator[](int index) const { assert(index >= 0 && index < 4); return (&x)[index]; }
304
305 inline bool operator==(const byte4& other) const { return x == other.x && y == other.y && z == other.z && w == other.w; }
306 inline bool operator!=(const byte4& other) const { return !(*this == other); }
307 };
308
309
310
311
312 struct short2
313 {
314 short x = 0, y = 0;
315
316 inline short& operator[](int index) { assert(index >= 0 && index < 2); return (&x)[index]; }
317 inline const short& operator[](int index) const { assert(index >= 0 && index < 2); return (&x)[index]; }
318
319 inline bool operator==(const short2& other) const { return x == other.x && y == other.y; }
320 inline bool operator!=(const short2& other) const { return !(*this == other); }
321 };
322
323 struct short3
324 {
325 short x = 0, y = 0, z = 0;
326
327 inline short& operator[](int index) { assert(index >= 0 && index < 3); return (&x)[index]; }
328 inline const short& operator[](int index) const { assert(index >= 0 && index < 3); return (&x)[index]; }
329
330 inline bool operator==(const short3& other) const { return x == other.x && y == other.y && z == other.z; }
331 inline bool operator!=(const short3& other) const { return !(*this == other); }
332 };
333
334 struct short4
335 {
336 short x = 0, y = 0, z = 0, w = 0;
337
338 inline short& operator[](int index) { assert(index >= 0 && index < 4); return (&x)[index]; }
339 inline const short& operator[](int index) const { assert(index >= 0 && index < 4); return (&x)[index]; }
340
341 inline bool operator==(const short4& other) const { return x == other.x && y == other.y && z == other.z && w == other.w; }
342 inline bool operator!=(const short4& other) const { return !(*this == other); }
343 };
344
345
346
347 using ushort = unsigned short;
348
349 struct ushort2
350 {
351 ushort x = 0, y = 0;
352
353 inline ushort& operator[](int index) { assert(index >= 0 && index < 2); return (&x)[index]; }
354 inline const ushort& operator[](int index) const { assert(index >= 0 && index < 2); return (&x)[index]; }
355
356 inline bool operator==(const ushort2& other) const { return x == other.x && y == other.y; }
357 inline bool operator!=(const ushort2& other) const { return !(*this == other); }
358 };
359
360 struct ushort3
361 {
362 ushort x = 0, y = 0, z = 0;
363
364 inline ushort& operator[](int index) { assert(index >= 0 && index < 3); return (&x)[index]; }
365 inline const ushort& operator[](int index) const { assert(index >= 0 && index < 3); return (&x)[index]; }
366
367 inline bool operator==(const ushort3& other) const { return x == other.x && y == other.y && z == other.z; }
368 inline bool operator!=(const ushort3& other) const { return !(*this == other); }
369 };
370
371 struct ushort4
372 {
373 ushort x = 0, y = 0, z = 0, w = 0;
374
375 inline ushort& operator[](int index) { assert(index >= 0 && index < 4); return (&x)[index]; }
376 inline const ushort& operator[](int index) const { assert(index >= 0 && index < 4); return (&x)[index]; }
377
378 inline bool operator==(const ushort4& other) const { return x == other.x && y == other.y && z == other.z && w == other.w; }
379 inline bool operator!=(const ushort4& other) const { return !(*this == other); }
380 };
381
382
383 struct color4b
384 {
385 byte r = 0, g = 0, b = 0, a = 0;
386
387 inline byte& operator[](int index) { assert(index >= 0 && index < 4); return (&r)[index]; }
388 inline const byte& operator[](int index) const { assert(index >= 0 && index < 4); return (&r)[index]; }
389
390 inline bool operator==(const color4b& other) const { return r == other.r && g == other.g && b == other.b && a == other.a; }
391 inline bool operator!=(const color4b& other) const { return !(*this == other); }
392 };
393
394 struct color4f
395 {
396 float r = 0, g = 0, b = 0, a = 0;
397
398 inline float& operator[](int index) { assert(index >= 0 && index < 4); return (&r)[index]; }
399 inline const float& operator[](int index) const { assert(index >= 0 && index < 4); return (&r)[index]; }
400
401 inline bool operator==(const color4f& other) const { return r == other.r && g == other.g && b == other.b && a == other.a; }
402 inline bool operator!=(const color4f& other) const { return !(*this == other); }
403 };
404
405
406 struct IntRect
407 {
408 union
409 {
410 struct { int32_t x, y, w, h; };
411 struct { int2 position, size; };
412 };
413
414 bool Contains(int2 p) const { return p.x >= x && p.y >= y && p.x < x + w && p.y < y + h; }
415
416 inline int32_t Min(int axis) const { return position[axis]; }
417 inline int32_t Max(int axis) const { return position[axis] + size[axis]; }
418
419 inline int2 Min() const { return position; }
420 inline int2 Max() const { return position + size; }
421
422 inline int2 Center() const { return { x + w / 2, y + h / 2 }; }
423 inline int2 TopLeft() const { return { x, y }; }
424 inline int2 TopCenter() const { return { x + w / 2, y }; }
425 inline int2 TopRight() const { return { x + w, y }; }
426 inline int2 MiddleLeft() const { return { x, y + h / 2 }; }
427 inline int2 MiddleRight() const { return { x + w, y + h / 2 }; }
428 inline int2 BottomLeft() const { return { x, y + h }; }
429 inline int2 BottomCenter()const { return { x + w / 2, y + h }; }
430 inline int2 BottomRight() const { return { x + w, y + h }; }
431
432 inline bool operator==(const IntRect& other) const { return x == other.x && y == other.y && w == other.w && h == other.h; }
433 inline bool operator!=(const IntRect& other) const { return !(*this == other); }
434
435 inline IntRect operator+ (const int2& other) const { return IntRect { .x = x + other.x, .y = y + other.y, .w = w, .h = h }; }
436 inline IntRect operator- (const int2& other) const { return IntRect { .x = x - other.x, .y = y - other.y, .w = w, .h = h }; }
437
438 inline IntRect& operator+=(const int2& other) { x += other.x; y += other.y; return *this; }
439 inline IntRect& operator-=(const int2& other) { x -= other.x; y -= other.y; return *this; }
440
441 static IntRect Inflate(IntRect a, int32_t t, int32_t r, int32_t b, int32_t l);
442 inline IntRect Inflate(int32_t t, int32_t r, int32_t b, int32_t l) const { return Inflate(*this, t, r, b, l); }
443
444 static IntRect Inflate(IntRect a, int32_t n);
445 inline IntRect Inflate(int32_t n) const { return Inflate(*this, n); }
446
447 static IntRect Deflate(IntRect a, int32_t t, int32_t r, int32_t b, int32_t l);
448 inline IntRect Deflate(int32_t t, int32_t r, int32_t b, int32_t l) const { return Deflate(*this, t, r, b, l); }
449
450 static IntRect Deflate(IntRect a, int32_t n);
451 inline IntRect Deflate(int32_t n) const { return Deflate(*this, n); }
452
454 inline IntRect Intersection(IntRect b) const { return Intersection(*this, b); }
455
457 inline IntRect Union(IntRect b) const { return Union(*this, b); }
458
459 inline bool IsEmpty() const { return *this == IntRect{ 0,0,0,0 }; }
460
462 IntRect Transform(const float3x2& m) const;
463 IntRect Transform(int2 offset, const float3x2& m) const;
464 IntRect Transform(IntRect parentRect, const float3x2& m) const;
465 };
466
467 uint16_t FloatToHalf(float value);
468 float HalfToFloat(uint16_t value);
469
473
475}// namespace tachyon
unsigned short ushort
Definition gui_base_types.h:347
float HalfToFloat(uint16_t value)
unsigned char byte
Definition gui_base_types.h:274
std::function< void()> OnGuiFunc
Definition gui_base_types.h:14
int64_t SteadyClockNowNanos()
Monotonic steady_clock time in nanoseconds; a plain int64_t keeps <chrono> out of widely-included hea...
uint16_t FloatToHalf(float value)
Definition gui_logging.h:24
Definition gui_base_types.h:407
IntRect operator-(const int2 &other) const
Definition gui_base_types.h:436
int2 Min() const
Definition gui_base_types.h:419
IntRect Transform(const float3x2 &m) const
The axis-aligned bounding rect of this rect transformed by m.
int2 MiddleLeft() const
Definition gui_base_types.h:426
IntRect Transform(int2 offset, const float3x2 &m) const
IntRect Inflate(int32_t t, int32_t r, int32_t b, int32_t l) const
Definition gui_base_types.h:442
IntRect Union(IntRect b) const
Definition gui_base_types.h:457
int32_t Min(int axis) const
Definition gui_base_types.h:416
IntRect Deflate(int32_t n) const
Definition gui_base_types.h:451
int32_t Max(int axis) const
Definition gui_base_types.h:417
static IntRect Union(IntRect a, IntRect b)
static IntRect Inflate(IntRect a, int32_t n)
bool Contains(int2 p) const
Definition gui_base_types.h:414
int2 Max() const
Definition gui_base_types.h:420
int2 Center() const
Definition gui_base_types.h:422
int2 BottomCenter() const
Definition gui_base_types.h:429
int2 TopCenter() const
Definition gui_base_types.h:424
IntRect Transform(IntRect parentRect, const float3x2 &m) const
IntRect Inflate(int32_t n) const
Definition gui_base_types.h:445
IntRect & operator+=(const int2 &other)
Definition gui_base_types.h:438
static IntRect Deflate(IntRect a, int32_t n)
bool operator==(const IntRect &other) const
Definition gui_base_types.h:432
IntRect Deflate(int32_t t, int32_t r, int32_t b, int32_t l) const
Definition gui_base_types.h:448
static IntRect Intersection(IntRect a, IntRect b)
static IntRect Deflate(IntRect a, int32_t t, int32_t r, int32_t b, int32_t l)
static IntRect Inflate(IntRect a, int32_t t, int32_t r, int32_t b, int32_t l)
int2 BottomRight() const
Definition gui_base_types.h:430
int2 MiddleRight() const
Definition gui_base_types.h:427
int2 TopLeft() const
Definition gui_base_types.h:423
int2 BottomLeft() const
Definition gui_base_types.h:428
IntRect operator+(const int2 &other) const
Definition gui_base_types.h:435
IntRect Intersection(IntRect b) const
Definition gui_base_types.h:454
IntRect & operator-=(const int2 &other)
Definition gui_base_types.h:439
int2 TopRight() const
Definition gui_base_types.h:425
bool operator!=(const IntRect &other) const
Definition gui_base_types.h:433
bool IsEmpty() const
Definition gui_base_types.h:459
Definition gui_base_types.h:277
byte & operator[](int index)
Definition gui_base_types.h:280
const byte & operator[](int index) const
Definition gui_base_types.h:281
bool operator==(const byte2 &other) const
Definition gui_base_types.h:283
bool operator!=(const byte2 &other) const
Definition gui_base_types.h:284
byte x
Definition gui_base_types.h:278
byte y
Definition gui_base_types.h:278
Definition gui_base_types.h:288
const byte & operator[](int index) const
Definition gui_base_types.h:292
bool operator==(const byte3 &other) const
Definition gui_base_types.h:294
byte & operator[](int index)
Definition gui_base_types.h:291
byte z
Definition gui_base_types.h:289
byte y
Definition gui_base_types.h:289
byte x
Definition gui_base_types.h:289
bool operator!=(const byte3 &other) const
Definition gui_base_types.h:295
Definition gui_base_types.h:299
const byte & operator[](int index) const
Definition gui_base_types.h:303
byte z
Definition gui_base_types.h:300
byte & operator[](int index)
Definition gui_base_types.h:302
bool operator==(const byte4 &other) const
Definition gui_base_types.h:305
byte x
Definition gui_base_types.h:300
byte w
Definition gui_base_types.h:300
bool operator!=(const byte4 &other) const
Definition gui_base_types.h:306
byte y
Definition gui_base_types.h:300
Definition gui_base_types.h:384
bool operator==(const color4b &other) const
Definition gui_base_types.h:390
const byte & operator[](int index) const
Definition gui_base_types.h:388
byte & operator[](int index)
Definition gui_base_types.h:387
byte b
Definition gui_base_types.h:385
byte g
Definition gui_base_types.h:385
byte a
Definition gui_base_types.h:385
bool operator!=(const color4b &other) const
Definition gui_base_types.h:391
byte r
Definition gui_base_types.h:385
Definition gui_base_types.h:395
const float & operator[](int index) const
Definition gui_base_types.h:399
float b
Definition gui_base_types.h:396
float r
Definition gui_base_types.h:396
bool operator!=(const color4f &other) const
Definition gui_base_types.h:402
float & operator[](int index)
Definition gui_base_types.h:398
bool operator==(const color4f &other) const
Definition gui_base_types.h:401
float a
Definition gui_base_types.h:396
float g
Definition gui_base_types.h:396
Definition gui_base_types.h:121
float2 & operator*=(float other)
Definition gui_base_types.h:142
float2 operator-() const
Definition gui_base_types.h:127
float & operator[](int index)
Definition gui_base_types.h:124
float2 & operator+=(const float2 &other)
Definition gui_base_types.h:138
float y
Definition gui_base_types.h:122
float2 & operator-=(const int2 &other)
Definition gui_base_types.h:132
bool operator!=(const float2 &other) const
Definition gui_base_types.h:146
float2 & operator/=(float other)
Definition gui_base_types.h:143
float2 operator/(float other) const
Definition gui_base_types.h:141
bool operator==(const float2 &other) const
Definition gui_base_types.h:145
const float & operator[](int index) const
Definition gui_base_types.h:125
float2 & operator+=(const int2 &other)
Definition gui_base_types.h:133
float2 & operator-=(const float2 &other)
Definition gui_base_types.h:137
float2 operator*(float other) const
Definition gui_base_types.h:140
float2 operator+() const
Definition gui_base_types.h:128
float x
Definition gui_base_types.h:122
Definition gui_base_types.h:203
bool operator==(const float2x2 &other) const
Definition gui_base_types.h:209
const float2 & operator[](int index) const
Definition gui_base_types.h:207
float2 r1
Definition gui_base_types.h:204
float2 r0
Definition gui_base_types.h:204
float2 & operator[](int index)
Definition gui_base_types.h:206
float2x2 operator*(float2x2 const &m2)
bool operator!=(const float2x2 &other) const
Definition gui_base_types.h:210
Definition gui_base_types.h:150
float3 operator/(float other) const
Definition gui_base_types.h:165
float y
Definition gui_base_types.h:151
float x
Definition gui_base_types.h:151
float3 operator+() const
Definition gui_base_types.h:157
bool operator==(const float3 &other) const
Definition gui_base_types.h:169
float3 & operator+=(const float3 &other)
Definition gui_base_types.h:162
float3 operator*(float other) const
Definition gui_base_types.h:164
float3 & operator-=(const float3 &other)
Definition gui_base_types.h:161
bool operator!=(const float3 &other) const
Definition gui_base_types.h:170
float3 & operator*=(float other)
Definition gui_base_types.h:166
float3 & operator/=(float other)
Definition gui_base_types.h:167
float z
Definition gui_base_types.h:151
float & operator[](int index)
Definition gui_base_types.h:153
float3 operator-() const
Definition gui_base_types.h:156
const float & operator[](int index) const
Definition gui_base_types.h:154
2D affine transform matrix (2 rows x 3 columns): x' = r0.x*x + r0.y*y + r0.z y' = r1....
Definition gui_base_types.h:219
float2 TransformVector(float2 p) const
bool operator!=(const float3x2 &other) const
Definition gui_base_types.h:226
float3x2 operator*(const float3x2 &b) const
static float3x2 Translate(float x, float y)
Definition gui_base_types.h:250
float3 & operator[](int index)
Definition gui_base_types.h:222
float3 r1
Definition gui_base_types.h:220
float2 TransformPoint(float2 p) const
const float3 & operator[](int index) const
Definition gui_base_types.h:223
static float3x2 Translate(float2 translation)
Definition gui_base_types.h:249
bool operator==(const float3x2 &other) const
Definition gui_base_types.h:225
static float3x2 Scale(float2 scale)
Definition gui_base_types.h:246
static constexpr float3x2 Identity()
Definition gui_base_types.h:228
static float3x2 Scale(float x, float y)
Definition gui_base_types.h:247
static float3x2 Scale(int s)
Definition gui_base_types.h:242
bool IsIdentity() const
Definition gui_base_types.h:230
static float3x2 Scale(float s)
Definition gui_base_types.h:248
float3x2 Inverse() const
static float3x2 Translate(int2 translation)
Definition gui_base_types.h:243
float3 r0
Definition gui_base_types.h:220
static float3x2 Translate(int x, int y)
Definition gui_base_types.h:244
static float3x2 Scale(int2 scale)
Definition gui_base_types.h:240
static float3x2 Scale(int x, int y)
Definition gui_base_types.h:241
Definition gui_base_types.h:174
float4 & operator*=(float other)
Definition gui_base_types.h:190
float4 operator+() const
Definition gui_base_types.h:181
float4 & operator+=(const float4 &other)
Definition gui_base_types.h:186
float4 operator/(float other) const
Definition gui_base_types.h:189
const float & operator[](int index) const
Definition gui_base_types.h:178
float y
Definition gui_base_types.h:175
float4 operator-() const
Definition gui_base_types.h:180
float x
Definition gui_base_types.h:175
float z
Definition gui_base_types.h:175
float4 & operator/=(float other)
Definition gui_base_types.h:191
float & operator[](int index)
Definition gui_base_types.h:177
float4 operator*(float other) const
Definition gui_base_types.h:188
float w
Definition gui_base_types.h:175
float4 & operator-=(const float4 &other)
Definition gui_base_types.h:185
float4 operator*(float const scale)
Definition gui_base_types.h:196
bool operator==(const float4 &other) const
Definition gui_base_types.h:193
bool operator!=(const float4 &other) const
Definition gui_base_types.h:194
Definition gui_base_types.h:259
float4 r3
Definition gui_base_types.h:260
bool operator!=(const float4x4 &other) const
Definition gui_base_types.h:266
float4 & operator[](int index)
Definition gui_base_types.h:262
float4 r1
Definition gui_base_types.h:260
float4 r2
Definition gui_base_types.h:260
float4 r0
Definition gui_base_types.h:260
float4x4 operator*(float4x4 const &m2) const
bool operator==(const float4x4 &other) const
Definition gui_base_types.h:265
const float4 & operator[](int index) const
Definition gui_base_types.h:263
Integer 2D vector.
Definition gui_base_types.h:19
int32_t x
Definition gui_base_types.h:20
int32_t & operator[](int index)
Definition gui_base_types.h:22
int2 & operator-=(const int2 &other)
Definition gui_base_types.h:32
bool operator==(const int2 &other) const
Definition gui_base_types.h:24
int2 operator+() const
Definition gui_base_types.h:28
int32_t y
Definition gui_base_types.h:20
bool operator!=(const int2 &other) const
Definition gui_base_types.h:25
int2 & operator+=(const int2 &other)
Definition gui_base_types.h:33
const int32_t & operator[](int index) const
Definition gui_base_types.h:23
int2 operator-() const
Definition gui_base_types.h:27
Definition gui_base_types.h:37
int32_t y
Definition gui_base_types.h:38
int3 & operator+=(const int3 &other)
Definition gui_base_types.h:51
int3 operator+() const
Definition gui_base_types.h:46
int3 & operator-=(const int3 &other)
Definition gui_base_types.h:50
int32_t & operator[](int index)
Definition gui_base_types.h:40
int3 operator-() const
Definition gui_base_types.h:45
int32_t x
Definition gui_base_types.h:38
bool operator!=(const int3 &other) const
Definition gui_base_types.h:43
int32_t z
Definition gui_base_types.h:38
bool operator==(const int3 &other) const
Definition gui_base_types.h:42
const int32_t & operator[](int index) const
Definition gui_base_types.h:41
Definition gui_base_types.h:55
bool operator==(const int4 &other) const
Definition gui_base_types.h:60
int32_t w
Definition gui_base_types.h:56
int4 operator+() const
Definition gui_base_types.h:64
int32_t x
Definition gui_base_types.h:56
int32_t y
Definition gui_base_types.h:56
int4 operator-() const
Definition gui_base_types.h:63
int32_t & operator[](int index)
Definition gui_base_types.h:58
bool operator!=(const int4 &other) const
Definition gui_base_types.h:61
const int32_t & operator[](int index) const
Definition gui_base_types.h:59
int32_t z
Definition gui_base_types.h:56
int4 & operator+=(const int4 &other)
Definition gui_base_types.h:69
int4 & operator-=(const int4 &other)
Definition gui_base_types.h:68
Definition gui_base_types.h:313
short x
Definition gui_base_types.h:314
bool operator!=(const short2 &other) const
Definition gui_base_types.h:320
short y
Definition gui_base_types.h:314
bool operator==(const short2 &other) const
Definition gui_base_types.h:319
short & operator[](int index)
Definition gui_base_types.h:316
const short & operator[](int index) const
Definition gui_base_types.h:317
Definition gui_base_types.h:324
short & operator[](int index)
Definition gui_base_types.h:327
const short & operator[](int index) const
Definition gui_base_types.h:328
short z
Definition gui_base_types.h:325
short x
Definition gui_base_types.h:325
short y
Definition gui_base_types.h:325
bool operator!=(const short3 &other) const
Definition gui_base_types.h:331
bool operator==(const short3 &other) const
Definition gui_base_types.h:330
Definition gui_base_types.h:335
short x
Definition gui_base_types.h:336
bool operator==(const short4 &other) const
Definition gui_base_types.h:341
short z
Definition gui_base_types.h:336
short w
Definition gui_base_types.h:336
short y
Definition gui_base_types.h:336
bool operator!=(const short4 &other) const
Definition gui_base_types.h:342
const short & operator[](int index) const
Definition gui_base_types.h:339
short & operator[](int index)
Definition gui_base_types.h:338
Definition gui_base_types.h:75
uint2 operator-(const uint2 &other) const
Definition gui_base_types.h:83
uint2 & operator-=(const uint2 &other)
Definition gui_base_types.h:85
uint32_t x
Definition gui_base_types.h:76
uint32_t y
Definition gui_base_types.h:76
uint2 operator+(const uint2 &other) const
Definition gui_base_types.h:84
bool operator==(const uint2 &other) const
Definition gui_base_types.h:80
uint32_t & operator[](int index)
Definition gui_base_types.h:78
const uint32_t & operator[](int index) const
Definition gui_base_types.h:79
bool operator!=(const uint2 &other) const
Definition gui_base_types.h:81
uint2 & operator+=(const uint2 &other)
Definition gui_base_types.h:86
Definition gui_base_types.h:90
bool operator!=(const uint3 &other) const
Definition gui_base_types.h:96
const uint32_t & operator[](int index) const
Definition gui_base_types.h:94
bool operator==(const uint3 &other) const
Definition gui_base_types.h:95
uint32_t z
Definition gui_base_types.h:91
uint32_t y
Definition gui_base_types.h:91
uint32_t x
Definition gui_base_types.h:91
uint3 operator-(const uint3 &other) const
Definition gui_base_types.h:98
uint3 & operator-=(const uint3 &other)
Definition gui_base_types.h:100
uint3 operator+(const uint3 &other) const
Definition gui_base_types.h:99
uint32_t & operator[](int index)
Definition gui_base_types.h:93
uint3 & operator+=(const uint3 &other)
Definition gui_base_types.h:101
Definition gui_base_types.h:105
uint4 & operator+=(const uint4 &other)
Definition gui_base_types.h:116
uint4 operator+(const uint4 &other) const
Definition gui_base_types.h:114
const uint32_t & operator[](int index) const
Definition gui_base_types.h:109
uint32_t y
Definition gui_base_types.h:106
bool operator!=(const uint4 &other) const
Definition gui_base_types.h:111
uint32_t z
Definition gui_base_types.h:106
uint4 & operator-=(const uint4 &other)
Definition gui_base_types.h:115
uint32_t & operator[](int index)
Definition gui_base_types.h:108
bool operator==(const uint4 &other) const
Definition gui_base_types.h:110
uint32_t x
Definition gui_base_types.h:106
uint4 operator-(const uint4 &other) const
Definition gui_base_types.h:113
uint32_t w
Definition gui_base_types.h:106
Definition gui_base_types.h:350
ushort & operator[](int index)
Definition gui_base_types.h:353
ushort x
Definition gui_base_types.h:351
const ushort & operator[](int index) const
Definition gui_base_types.h:354
ushort y
Definition gui_base_types.h:351
bool operator==(const ushort2 &other) const
Definition gui_base_types.h:356
bool operator!=(const ushort2 &other) const
Definition gui_base_types.h:357
Definition gui_base_types.h:361
ushort y
Definition gui_base_types.h:362
const ushort & operator[](int index) const
Definition gui_base_types.h:365
ushort x
Definition gui_base_types.h:362
bool operator!=(const ushort3 &other) const
Definition gui_base_types.h:368
ushort z
Definition gui_base_types.h:362
bool operator==(const ushort3 &other) const
Definition gui_base_types.h:367
ushort & operator[](int index)
Definition gui_base_types.h:364
Definition gui_base_types.h:372
ushort y
Definition gui_base_types.h:373
bool operator!=(const ushort4 &other) const
Definition gui_base_types.h:379
const ushort & operator[](int index) const
Definition gui_base_types.h:376
ushort & operator[](int index)
Definition gui_base_types.h:375
ushort x
Definition gui_base_types.h:373
ushort w
Definition gui_base_types.h:373
bool operator==(const ushort4 &other) const
Definition gui_base_types.h:378
ushort z
Definition gui_base_types.h:373