Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
Color.h
Go to the documentation of this file.
1#ifndef NW4HBM_UT_COLOR_H
2#define NW4HBM_UT_COLOR_H
3
4#include <revolution/types.h>
5#include <revolution/gx.h>
6
7
8namespace nw4hbm {
9 namespace ut {
10 typedef struct Color : public GXColor {
11 static const u32 RED = 0xFF0000FF;
12 static const u32 GREEN = 0x00FF00FF;
13 static const u32 BLUE = 0x0000FFFF;
14
15 static const u32 CYAN = 0x00FFFFFF;
16 static const u32 MAGENTA = 0xFF00FFFF;
17 static const u32 YELLOW = 0xFFFF00FF;
18
19 static const u32 BLACK = 0x000000FF;
20 static const u32 GRAY = 0x808080FF;
21 static const u32 WHITE = 0xFFFFFFFF;
22
23 static const u32 NOCOLOR = 0x00000000;
24 static const u32 MAXCOLOR = 0xFFFFFFFF;
25
26 // Constructor
27
28 Color() { *this = WHITE; }
29 Color(u32 color) { *this = color; }
30 Color(const GXColor& color) { *this = color; }
31 Color(int red, int green, int blue, int alpha) { Set(red, green, blue, alpha); }
32
33 // Left out destructor
34
35 ~Color() {}
36
37 // Operators
38
40 ToU32ref() = color;
41 return *this;
42 }
43
44 Color& operator=(const GXColor& color) {
45 return *this = *reinterpret_cast<const u32*>(&color);
46 }
47
48 Color operator|(u32 color) const { return Color(ToU32() | color); }
49 Color operator&(u32 color) const { return Color(ToU32() & color); }
50
51 u32& ToU32ref() { return *reinterpret_cast<u32*>(this); }
52 const u32& ToU32ref() const { return *reinterpret_cast<const u32*>(this); }
53 u32 ToU32() const { return ToU32ref(); }
54
55 operator u32() const { return ToU32ref(); }
56
57 // Functions
58
59 void Set(int red, int green, int blue, int alpha) {
60 r = red;
61 g = green;
62 b = blue;
63 a = alpha;
64 }
66 } // namespace ut
67} // namespace nw4hbm
68
69#endif
unsigned long u32
Definition types.h:12
nw4hbm::ut::Color Color
Definition HBMAnmController.h:6
Definition GXStruct.h:30
u8 g
Definition GXStruct.h:31
u8 b
Definition GXStruct.h:31
u8 a
Definition GXStruct.h:31
u8 r
Definition GXStruct.h:31
Definition Color.h:10
static const u32 BLACK
Definition Color.h:19
Color operator|(u32 color) const
Definition Color.h:48
static const u32 YELLOW
Definition Color.h:17
static const u32 MAGENTA
Definition Color.h:16
Color & operator=(const GXColor &color)
Definition Color.h:44
static const u32 NOCOLOR
Definition Color.h:23
~Color()
Definition Color.h:35
static const u32 RED
Definition Color.h:11
Color(int red, int green, int blue, int alpha)
Definition Color.h:31
static const u32 WHITE
Definition Color.h:21
static const u32 BLUE
Definition Color.h:13
static const u32 GRAY
Definition Color.h:20
u32 ToU32() const
Definition Color.h:53
static const u32 GREEN
Definition Color.h:12
Color & operator=(u32 color)
Definition Color.h:39
const u32 & ToU32ref() const
Definition Color.h:52
void Set(int red, int green, int blue, int alpha)
Definition Color.h:59
Color(u32 color)
Definition Color.h:29
static const u32 MAXCOLOR
Definition Color.h:24
u32 & ToU32ref()
Definition Color.h:51
static const u32 CYAN
Definition Color.h:15
Color(const GXColor &color)
Definition Color.h:30
Color()
Definition Color.h:28
Color operator&(u32 color) const
Definition Color.h:49