5 #include <Multimedia/SDX.h>
6 #include <Multimedia/Screen.h>
22 SDL_Window* handle =
nullptr;
24 bool isFullScreen =
false;
28 static std::list<SubWindow*> windowS;
30 static void CheckWindowID(
int 削除するWindowのID)
32 for (
auto it : windowS)
34 if (SDL_GetWindowID(it->handle) == 削除するWindowのID)
53 SubWindow(
const char* ウィンドウ名,
int 幅,
int 高さ,
bool フルスクリーンフラグ =
false)
55 Create(ウィンドウ名, 幅, 高さ, フルスクリーンフラグ);
74 bool Create(
const char* ウィンドウ名,
int 幅,
int 高さ,
bool フルスクリーンフラグ =
false)
76 if (handle !=
nullptr){
return false; }
80 isFullScreen = フルスクリーンフラグ;
85 flag = SDL_WINDOW_FULLSCREEN;
88 handle = SDL_CreateWindow(ウィンドウ名, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 幅, 高さ, flag);
90 renderer.Create(handle);
92 windowS.push_back(
this);
101 if (handle ==
nullptr){
return false; }
103 renderer.isWindow =
false;
105 SDL_DestroyWindow(handle);
107 if (windowS.size() >= 2)
109 windowS.remove(
this);
120 if (handle ==
nullptr){
return false; }
124 SDL_ShowWindow(handle);
128 SDL_HideWindow(handle);
137 if (handle ==
nullptr){
return false; }
139 isFullScreen = フルスクリーンフラグ;
144 SDL_SetWindowFullscreen( handle, SDL_WINDOW_FULLSCREEN_DESKTOP);
148 SDL_SetWindowFullscreen( handle, 0);
160 if (handle ==
nullptr){
return false; }
162 SDL_SetWindowTitle(handle, タイトル名);
169 if (handle ==
nullptr){
return false; }
174 SDL_RenderSetLogicalSize(renderer.
GetHandle(), 幅, 高さ);
175 SDL_SetWindowSize(handle, 幅, 高さ);
195 if (handle ==
nullptr){
return{ 0, 0, 0, 0 }; }
198 SDL_GetWindowPosition(handle, &x, &y);
200 return{ x, y, width, height };
209 if (handle ==
nullptr){
return false; }
211 SDL_Surface* icon = IMG_Load(ファイル名);
212 if (icon ==
nullptr){
return false; }
214 SDL_SetWindowIcon(handle, icon);
215 SDL_FreeSurface(icon);
Renderer & GetRenderer()
対応Rendererの取得.
Definition: SubWindow.h:67
bool SetFullscreen(bool フルスクリーンフラグ)
スクリーンモードを設定する.
Definition: SubWindow.h:135
マウスの状態を表すクラス.
Definition: Mouse.h:30
矩形を表す図形クラス.
Definition: Rect.h:22
int GetHeight()
高さの取得.
Definition: SubWindow.h:187
bool SetTitle(const char *タイトル名)
タイトルを設定.
Definition: SubWindow.h:155
int GetWidth()
幅の取得.
Definition: SubWindow.h:181
void Update()
描画処理を反映する.
Definition: SubWindow.h:221
タッチ操作の各種ジェスチャー.
Definition: Gesture.h:12
ライブラリの初期化やシステム的な処理を行う関数群.
Definition: System.h:13
bool Create(const char *ウィンドウ名, int 幅, int 高さ, bool フルスクリーンフラグ=false)
Windowの初期化と生成.
Definition: SubWindow.h:74
bool Destroy()
Rendererを削除.
Definition: Renderer.h:89
SDL_Renderer * GetHandle()
描画ハンドルを取得.
Definition: Renderer.h:68
bool SetIcon(const char *ファイル名)
ウィンドウのアイコンを設定.
Definition: SubWindow.h:204
SubWindow(const char *ウィンドウ名, int 幅, int 高さ, bool フルスクリーンフラグ=false)
Windowの初期化と生成.
Definition: SubWindow.h:53
描画先を表すクラス.
Definition: Renderer.h:27
bool Clear()
画面を消去する.
Definition: Renderer.h:160
SDL_Window * GetHandle()
Windowハンドルの取得.
Definition: SubWindow.h:60
static SDL_Renderer * GetHandle()
スクリーンハンドルを取得.
Definition: Screen.h:26
ウィンドウを表すクラス.
Definition: SubWindow.h:13
bool SetSize(int 幅, int 高さ)
ウィンドウサイズの設定.
Definition: SubWindow.h:167
static SubWindow mainWindow
現在アクティブなウィンドウ
Definition: SubWindow.h:43
bool Destroy()
SubWindowを削除.
Definition: SubWindow.h:99
タッチ操作.
Definition: Touch.h:12
Rect GetSize()
ウィンドウの位置と座標を取得.
Definition: SubWindow.h:193
bool SetShowFlag(bool 表示フラグ)
ウィンドウの表示/非表示設定.
Definition: SubWindow.h:118
アクティブなSubWindowを操作するクラス.
Definition: Window.h:14