SDXFrameWork  0.13
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Static Public Attributes | Friends | List of all members
SDX::SubWindow Class Reference

ウィンドウを表すクラス. More...

#include <SubWindow.h>

Public Member Functions

 SubWindow (const char *ウィンドウ名, int 幅, int 高さ, bool フルスクリーンフラグ=false)
 Windowの初期化と生成. More...
 
SDL_Window * GetHandle ()
 Windowハンドルの取得. More...
 
RendererGetRenderer ()
 対応Rendererの取得. More...
 
bool Create (const char *ウィンドウ名, int 幅, int 高さ, bool フルスクリーンフラグ=false)
 Windowの初期化と生成. More...
 
bool Destroy ()
 SubWindowを削除. More...
 
bool SetShowFlag (bool 表示フラグ)
 ウィンドウの表示/非表示設定. More...
 
bool SetFullscreen (bool フルスクリーンフラグ)
 スクリーンモードを設定する. More...
 
bool SetTitle (const char *タイトル名)
 タイトルを設定. More...
 
bool SetSize (int 幅, int 高さ)
 ウィンドウサイズの設定. More...
 
int GetWidth ()
 幅の取得. More...
 
int GetHeight ()
 高さの取得. More...
 
Rect GetSize ()
 ウィンドウの位置と座標を取得. More...
 
bool SetIcon (const char *ファイル名)
 ウィンドウのアイコンを設定. More...
 
void Update ()
 描画処理を反映する. More...
 
void SetLogicalSize (int 幅, int 高さ)
 描画領域の大きさを設定する. More...
 

Static Public Attributes

static SubWindow mainWindow
 現在アクティブなウィンドウ
 

Friends

class System
 
class Mouse
 
class Gesture
 
class Touch
 
class Window
 
class Renderer
 

Detailed Description

ウィンドウを表すクラス.

Windowに無くてSubWindowにある関数は[SubWindow専用]と表記.

Todo:
複数ウィンドウの動作確認は不完全
//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//メインウィンドウとサブウィンドウを作成
//メインウィンドウを閉じると終了
#include <SDXFramework.h>
bool SampleWindow()
{
using namespace SDX;
System::Initialise("MainWindow", 320, 240);
SubWindow sub("SubWindow",200,200);
//SetLogicalSizeしておくと、ウィンドウの解像度を上げても描画される解像度はそのままになる
//Windowサイズを変えた後に呼び出しても良い
while (System::Update())
{
Window::SetIcon("data/icon000.png");
sub.SetIcon("data/icon009.png");
Drawing::String({ 10, 100 }, Color::White, { "Windowクラスのテスト:Enterで終了" ,Input::mouse.x," ",Input::mouse.y});
Screen::SetRenderer(sub.GetRenderer());
Drawing::String({ 10, 100 }, Color::White, { "SubWindowクラスのテスト:Enterで終了", Input::mouse.x," ", Input::mouse.y });
if (Input::key._1.on){ Window::SetTitle("Mainタイトルを変えたよ!"); }//ウィンドウタイトルを変更
if (Input::key._2.on){Window::SetSize(640, 480);}//ウィンドウの大きさを変更
if (Input::key._3.on) { Window::SetFullscreen(true); }
if (Input::key._4.on) { Window::SetFullscreen(false); }
if (Input::key._5.on) { Window::SetIcon("icon.png"); }
if (Input::key._6.on){ sub.SetTitle("Subタイトルを変えたよ!"); }//ウィンドウタイトルを変更
if (Input::key._7.on) { sub.SetSize(400, 400); }//ウィンドウの大きさを変更
if (Input::key._8.on) { sub.SetFullscreen(true); }
if (Input::key._9.on) { sub.SetFullscreen(false); }
if (Input::key._0.on) { sub.SetIcon("icon.png"); }
if (Input::key.Return.on){ break; }//Enterで終了
sub.Update();
}
return true;
}

Constructor & Destructor Documentation

SDX::SubWindow::SubWindow ( const char *  ウィンドウ名,
int  ,
int  高さ,
bool  フルスクリーンフラグ = false 
)
inline

Windowの初期化と生成.

Member Function Documentation

SDL_Window* SDX::SubWindow::GetHandle ( )
inline

Windowハンドルの取得.

[SubWindow専用]

Renderer& SDX::SubWindow::GetRenderer ( )
inline

対応Rendererの取得.

[SubWindow専用]

bool SDX::SubWindow::Create ( const char *  ウィンドウ名,
int  ,
int  高さ,
bool  フルスクリーンフラグ = false 
)
inline

Windowの初期化と生成.

[SubWindow専用]

bool SDX::SubWindow::Destroy ( )
inline

SubWindowを削除.

[SubWindow専用]

bool SDX::SubWindow::SetShowFlag ( bool  表示フラグ)
inline

ウィンドウの表示/非表示設定.

[SubWindow専用]

bool SDX::SubWindow::SetFullscreen ( bool  フルスクリーンフラグ)
inline

スクリーンモードを設定する.

bool SDX::SubWindow::SetTitle ( const char *  タイトル名)
inline

タイトルを設定.

bool SDX::SubWindow::SetSize ( int  ,
int  高さ 
)
inline

ウィンドウサイズの設定.

int SDX::SubWindow::GetWidth ( )
inline

幅の取得.

int SDX::SubWindow::GetHeight ( )
inline

高さの取得.

Rect SDX::SubWindow::GetSize ( )
inline

ウィンドウの位置と座標を取得.

bool SDX::SubWindow::SetIcon ( const char *  ファイル名)
inline

ウィンドウのアイコンを設定.

void SDX::SubWindow::Update ( )
inline

描画処理を反映する.

void SDX::SubWindow::SetLogicalSize ( int  ,
int  高さ 
)
inline

描画領域の大きさを設定する.

例えばSetSizeの半分にすると2倍表示になる