![]() ![]() ![]()
|
BREW C++ ライブラリ & GUI フレームワーク : SophiaFramework 3.0 |
SophiaFramework での「点」の表現法は2種類あります。座標上の1点を表す「グリッド」(SFXGrid クラス) と、画面に描画するための点、すなわち「ピクセル」(SFXPixel クラス) の2種類です。
囲碁・将棋にたとえると、盤面が「描画する平面」、囲碁の碁石を置く場所が「グリッド」、将棋の駒を置く場所が「ピクセル」です。
使用開始
// (10, 20) にあるピクセル
SFXPixel pixel(10, 20);
点(ピクセル)を描画
SFXGraphicsPtr graphics = SFXGraphics::GetInstance(); graphics->DrawPixel(pixel);
値の取得
SInt32 x = pixel.GetX(); // x は 10 SInt32 y = pixel.GetY(); // y は 20
値の設定
pixel.Set(15, 25); pixel.SetX(15); pixel.SetY(25);
値の演算
SFXPixel pixel(10, 20);
SFXGraphicsPtr graphics = SFXGraphics::GetInstance();
SInt32 i;
for (i = 0; i < 50; ++i) {
// 点を描画
graphics->DrawPixel(pixel, SFXRGBColor(0x00, 0x00, 0x00, 0x00));
// 点を右に 3 移動
pixel.AddX(3);
}
for (i = 0; i < 50; ++i) {
// 点を描画
graphics->DrawPixel(pixel, SFXRGBColor(0x00, 0x00, 0x00, 0x00));
// 点を左に 3、下に 3 移動
pixel.Offset(-3, 3);
}
描画関係以外はピクセルと同じです。
使用開始
// (10, 20) にあるグリッド
SFXGrid grid(10, 20);
値の取得
SInt32 x = grid.GetX(); // x は 10 SInt32 y = grid.GetY(); // y は 20
値の設定
grid.Set(15, 25); grid.SetX(15); grid.SetY(25);
値の演算
// 点を右に 3 移動 grid.AddX(3); // 点を左に 3、下に 3 移動 grid.Add(-3, 3);
関数の引数として使用
SFXGraphicsPtr graphics = SFXGraphics::GetInstance(); // テキストを描画する。描画位置 (左上の点) を grid で指定 graphics->DrawText("drawing", grid); // 画像を描画する。左上が (10, 20) となる。 // image は SFBImageSmp 型 (スマートポインタ) image->Draw(SFXGrid(10, 20));
|
Copyright (C) 2002 - 2009 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|