SDXFrameWork  0.09
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Color.h
1 #pragma once//☀SDL
2 
3 namespace SDX
4 {
7 class Color
8 {
9 private:
10  ColorData data;
11 public :
14  Color(int 赤,int 緑,int 青 , int 透過率 = 255)
15  {
16  SetColor(赤,緑,青,透過率);
17  }
18 
19  void SetColor(int 赤, int 緑, int 青, int 透過率 = 255)
20  {
21  data = { (Uint8)赤, (Uint8)緑, (Uint8)青, (Uint8)透過率 };
22  }
23 
25  int GetRed() const
26  {
27  return data.r;
28  }
29 
31  int GetGreen() const
32  {
33  return data.g;
34  }
35 
37  int GetBlue() const
38  {
39  return data.b;
40  }
41 
43  int GetAlpha() const
44  {
45  return data.a;
46  }
47 
48  operator ColorData()
49  {
50  return data;
51  }
52 
53  bool operator==(Color 比較色) {
54  return (
55  GetRed() == 比較色.GetRed() &&
56  GetBlue() == 比較色.GetBlue() &&
57  GetGreen() == 比較色.GetGreen() &&
58  GetAlpha() == 比較色.GetAlpha()
59  );
60  }
61 
62  static const Color Black;
63  static const Color Dilver;
64  static const Color Gray;
65  static const Color White;
66  static const Color Maroon;
67  static const Color Red;
68  static const Color Purple;
69  static const Color Fuchsia;
70  static const Color Green;
71  static const Color Lime;
72  static const Color Olive;
73  static const Color Yellow;
74  static const Color Navy;
75  static const Color Blue;
76  static const Color Teal;
77  static const Color Aqua;
78 };
79 
80 }
int GetGreen() const
緑の要素を取得.
Definition: Color.h:31
int GetBlue() const
青の要素を取得.
Definition: Color.h:37
Color(int 赤, int 緑, int 青, int 透過率=255)
RGB値から色に変換.
Definition: Color.h:14
色を表すクラス.
Definition: Color.h:7
int GetRed() const
赤の要素を取得.
Definition: Color.h:25
int GetAlpha() const
透明度を取得.
Definition: Color.h:43