NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
ut_Color.h
1#ifndef NW4R_UT_COLOR_H
2#define NW4R_UT_COLOR_H
3#include <nw4r/types_nw4r.h>
4
5#include <revolution/GX.h>
6
7namespace nw4r {
8namespace ut {
9
10struct Color : public GXColor {
11public:
12 Color() {
13 *this = WHITE;
14 }
15 Color(ulong color) {
16 *this = color;
17 }
18 Color(int red, int green, int blue, int alpha) {
19 Set(red, green, blue, alpha);
20 }
21 Color(const GXColor& rColor) {
22 *this = rColor;
23 }
24
25 ~Color() {}
26
27 void Set(int red, int green, int blue, int alpha) {
28 r = red;
29 g = green;
30 b = blue;
31 a = alpha;
32 }
33
34 Color& operator=(ulong color) {
35 Toulongref() = color;
36 return *this;
37 }
38 Color& operator=(const GXColor& rColor) {
39 *this = *reinterpret_cast<const ulong*>(&rColor);
40 return *this;
41 }
42
43 Color operator|(ulong color) const {
44 return Color(Toulong() | color);
45 }
46 Color operator&(ulong color) const {
47 return Color(Toulong() & color);
48 }
49
50 ulong& Toulongref() {
51 return *reinterpret_cast<ulong*>(this);
52 }
53 const ulong& Toulongref() const {
54 return *reinterpret_cast<const ulong*>(this);
55 }
56
57 ulong Toulong() const {
58 return Toulongref();
59 }
60
61 operator ulong() const {
62 return Toulongref();
63 }
64
65 // clang-format off
66 static const ulong RED = 0xFF0000FF;
67 static const ulong GREEN = 0x00FF00FF;
68 static const ulong BLUE = 0x0000FFFF;
69
70 static const ulong CYAN = 0x00FFFFFF;
71 static const ulong MAGENTA = 0xFF00FFFF;
72 static const ulong YELLOW = 0xFFFF00FF;
73
74 static const ulong BLACK = 0x000000FF;
75 static const ulong GRAY = 0x808080FF;
76 static const ulong WHITE = 0xFFFFFFFF;
77 // clang-format on
78} ALIGN(4);
79
80} // namespace ut
81} // namespace nw4r
82
83#endif
Debugging library which includes various utilities used by the rest of nw4r.
Definition ut_list.cpp:4