SDXFrameWork  0.10
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...
 

Static Public Attributes

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

Friends

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

Detailed Description

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

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

//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", 640, 480);
SubWindow sub("SubWindow",400,400);
while (System::Update())
{
Window::SetIcon("data/icon000.png");
sub.SetIcon("data/icon009.png");
Drawing::String({ 10, 100 }, Color::White, { "Windowクラスのテスト" ,Input::mouse.x," ",Input::mouse.y});
Screen::SetRenderer(sub.GetRenderer());
Drawing::String({ 10, 100 }, Color::White, { "SubWindowクラスのテスト", Input::mouse.x," ", Input::mouse.y });
if (Input::key._1.on){ Window::SetTitle("Mainタイトルを変えたよ!"); }//ウィンドウタイトルを変更
if (Input::key._2.on) { Window::SetSize(320, 240); }//ウィンドウの大きさを変更
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(200, 200); }//ウィンドウの大きさを変更
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 
)

Windowの初期化と生成.

Member Function Documentation

SDL_Window* SDX::SubWindow::GetHandle ( )

Windowハンドルの取得.

[SubWindow専用]

Renderer& SDX::SubWindow::GetRenderer ( )

対応Rendererの取得.

[SubWindow専用]

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

Windowの初期化と生成.

[SubWindow専用]

bool SDX::SubWindow::Destroy ( )

SubWindowを削除.

[SubWindow専用]

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

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

[SubWindow専用]

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

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

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

タイトルを設定.

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

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

int SDX::SubWindow::GetWidth ( )

幅の取得.

int SDX::SubWindow::GetHeight ( )

高さの取得.

Rect SDX::SubWindow::GetSize ( )

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

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

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

void SDX::SubWindow::Update ( )

描画処理を反映する.