SDXFrameWork  0.07
SDXFrameWork
 全て クラス ネームスペース 関数 変数 列挙型 列挙型の値 ページ
Screen.h
1 #pragma once//☀SDL
2 #include <Multimedia/SDX.h>
3 #include <Multimedia/Color.h>
4 
5 namespace SDX
6 {
8 enum class DrawMode
9 {
10  Nearest,
11  Bilinear,
12 };
13 
15 enum class BlendMode
16 {
17  NoBlend = SDL_BLENDMODE_NONE,
18  Alpha = SDL_BLENDMODE_BLEND,
19  Add = SDL_BLENDMODE_ADD,
20  Sub,
21  Mula = SDL_BLENDMODE_MOD,
22  Invsrc
23 };
24 
25 class Image;
28 class Screen
29 {
30 private:
31  Screen(){};
32  ~Screen(){};
33  ScreenHandle handle = 0;
34 public:
35 
36  BlendMode nowBlendMode = BlendMode::NoBlend;
37  int blendParam = 0;
38  Color clearColor = Color(0, 0, 0);//消去時の色
39  Color rgba = Color(255, 255, 255, 0);//描画輝度と透明度
40 
42  static Screen& Single()
43  {
44  static Screen single;
45  return single;
46  }
47 
49  static ScreenHandle GetHandle()
50  {
51  return Single().handle;
52  }
53 
55  static void SetRenderer(ScreenHandle handle)
56  {
57  Single().handle = handle;
58  }
59 
61  static bool SetArea(int 座標X , int 座標Y , int 幅 , int 高さ)
62  {
63  return false;
64  }
65 
70  static bool SetCreateGraphColorBitDepth(int ビット深度)
71  {
72  return false;
73  }
74 
79  static bool SetCreateValidGraphChannelNum(int チャンネル数)
80  {
81  return false;
82  }
83 
87  static bool SetBack()
88  {
89  return false;
90  }
91 
93  static bool SetBackColor( Color 背景色 )
94  {
95  Single().clearColor.SetColor(背景色.GetRed(), 背景色.GetGreen(), 背景色.GetBlue());
96 
97  return true;
98  }
99 
101  static bool Flip()
102  {
103  SDL_RenderPresent(GetHandle());
104  return true;
105  }
106 
108  static bool Copy()
109  {
110  SDL_RenderPresent(GetHandle());
111  return true;
112  }
113 
115  static bool Clear()
116  {
117  SDL_SetRenderDrawColor
118  (
120  Single().clearColor.GetRed(),
121  Single().clearColor.GetGreen(),
122  Single().clearColor.GetBlue(),
123  0
124  );
125  SDL_RenderClear(GetHandle());
126  return true;
127  }
128 
130  static bool SetMode(DrawMode 補完モード)
131  {
132  return false;
133  }
134 
136  static bool SetBlendMode(BlendMode ブレンドモード,int 設定値)
137  {
138  Single().nowBlendMode = ブレンドモード;
139  if(設定値 > 255) Single().blendParam = 255;
140  else if(設定値 < 0) Single().blendParam = 0;
141  else Single().blendParam = 設定値;
142 
143  return true;
144  }
145 
147  static bool SaveBmp(int 座標X, int 座標Y , int 幅 , int 高さ , const char *ファイル名 )
148  {
149  return false;
150  }
151 
153  static bool SetBright( Color 輝度 )
154  {
155  Single().rgba.SetColor(輝度.GetRed(), 輝度.GetGreen(), 輝度.GetBlue());
156  return true;
157  }
158 
160  static bool SetTransColor(Color 輝度)
161  {
162  return false;
163  }
164 
166  static void SetZUse(bool 使用フラグ )
167  {
168  return;
169  }
170 
172  static void SetZWrite(bool 使用フラグ )
173  {
174  return;
175  }
176 
178  static void SetZDepth(double Z深度)
179  {
180  return;
181  }
182 };
183 }
static bool SetBlendMode(BlendMode ブレンドモード, int 設定値)
ブレンド描画のモードを設定.
Definition: Screen.h:136
描画先を表すクラス.
Definition: Screen.h:28
int GetGreen() const
緑の要素を取得.
Definition: Color.h:31
static bool Flip()
描画内容を反映.
Definition: Screen.h:101
書込時、末尾に追加
int GetBlue() const
青の要素を取得.
Definition: Color.h:37
static Screen & Single()
シングルトンなインスタンスを取得.
Definition: Screen.h:42
static bool SetBright(Color 輝度)
描画輝度を設定.
Definition: Screen.h:153
static bool SetCreateGraphColorBitDepth(int ビット深度)
作成する画像のビット深度を設定[DXLIB].
Definition: Screen.h:70
ニアレストネイバー法
static void SetZUse(bool 使用フラグ)
Zバッファ使用フラグを設定[DXLIB].
Definition: Screen.h:166
static bool Clear()
画面を消去する.
Definition: Screen.h:115
static void SetZDepth(double Z深度)
Z描画深度0.0~1.0の範囲で設定[DXLIB].
Definition: Screen.h:178
static bool SetCreateValidGraphChannelNum(int チャンネル数)
スクリーン用Imageのチャンネル数を設定[DXLIB].
Definition: Screen.h:79
色を表すクラス.
Definition: Color.h:7
static bool SetBack()
描画先の設定[DXLIB].
Definition: Screen.h:87
static bool SetTransColor(Color 輝度)
透過色を設定[DXLIB].
Definition: Screen.h:160
static bool SetArea(int 座標X, int 座標Y, int 幅, int 高さ)
描画範囲を設定する、設定範囲外には描画されない[DXLIB].
Definition: Screen.h:61
static void SetZWrite(bool 使用フラグ)
Zバッファ描画フラグを設定[DXLIB].
Definition: Screen.h:172
DrawMode
補完の方法.
Definition: Screen.h:8
int GetRed() const
赤の要素を取得.
Definition: Color.h:25
static bool SaveBmp(int 座標X, int 座標Y, int 幅, int 高さ, const char *ファイル名)
描画対象になっている画面の一部をBMP形式で保存[DXLIB].
Definition: Screen.h:147
static void SetRenderer(ScreenHandle handle)
スクリーンハンドルを設定.
Definition: Screen.h:55
static bool SetBackColor(Color 背景色)
Screen::Clear後の色を設定.
Definition: Screen.h:93
バイリニア法
static bool SetMode(DrawMode 補完モード)
拡大描画の補完方法を設定[DXLIB].
Definition: Screen.h:130
BlendMode
ブレンドモード.
Definition: Screen.h:15
static ScreenHandle GetHandle()
スクリーンハンドルを取得.
Definition: Screen.h:49
static bool Copy()
裏画面の内容を、表画面にコピー.
Definition: Screen.h:108