SDXFrameWork  0.10
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Public Attributes | Protected Attributes | List of all members
SDX::SpFrame Class Reference

IFrameスプライト. More...

#include <Sprite.h>

Inherits SDX::ISprite.

Public Member Functions

 SpFrame (const IFrame *描画する枠)
 コンストラクタ. More...
 
void Draw (const IShape &座標) override
 ISpriteを描画する. More...
 
void SetZoom (double X拡大率, double Y拡大率)
 表示倍率を設定. More...
 
void MultiZoom (double 倍率)
 拡大率を掛け算する. More...
 
void MultiZoom (double X倍率, double Y倍率)
 縦横別で拡大率を掛け算する. More...
 
double GetZoomX ()
 横方向の表示倍率を取得. More...
 
double GetZoomY ()
 縦方向の表示倍率を取得. More...
 
double GetAngle ()
 表示角度を取得. More...
 
void SetAngle (double 角度)
 表示角度を設定. More...
 
void Rotate (double 回転する角度)
 回転させる. More...
 
virtual void Update ()
 Anime等の更新処理. More...
 

Public Attributes

bool isTurn = false
 反転フラグ
 
Color color = { 255, 255, 255, 255 }
 描画色
 
Point gap = {0,0}
 Shape中心とSpriteとの位置差
 
Point axis = {0,0}
 回転軸のずれ
 

Protected Attributes

double zoomX = 1
 描画倍率
 
double zoomY = 1
 描画倍率
 
double angle = 0
 角度
 

Detailed Description

IFrameスプライト.

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//初期化を行い何かキーを押すと終了する
bool SampleModel()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
Image くま("data/pipo-enemy037.png");
Font フォント(SystemFont::Gothic, 10);
Film がいこつ("data/hone.png", 12, 3, 4,12);
ImagePack 枠画像("data/pipo-WindowBase001.png",9,3,3);
BmpFrame 枠(&枠画像);
がいこつ.SetType(FilmType::Reverse);
//各種スプライトと組み合わせたモデル
Model<Point, SpImage> modelA({ 100, 400 }, &くま);
Model<Circle, SpAnime> modelB({ 200, 300 ,20}, &がいこつ);
Model<Rect, SpFont> modelC({ 320, 240 , 100, 10}, { &フォント ,"Hello World"});
Model<Rect, SpFrame> modelD({ 400, 100, 100, 100 }, &枠);
//各種モーション
MOTION::Bound<SPEED::Liner> motionA( 5 , { 0, 0, 640, 480 } , PAI/4);
MOTION::Bound<SPEED::Liner> motionB( 10 , { 0, 0, 640, 480 }, PAI/3);
MOTION::Orbit<SPEED::Liner> motionC(0.05, 200, 100, PAI / 4);
MOTION::ToPoint<SPEED::Liner> motionD(5, { 320, 240 });
IModel *modelS[4] = {&modelA,&modelB,&modelC,&modelD};
MOTION::IMotion *motionS[4] = { &motionA, &motionB, &motionC, &motionD};
while (System::Update())
{
for (int a = 0; a < 4; ++a)
{
modelS[a]->iSprite.Update();//SpAnimeは更新が必要
motionS[a]->Update( modelS[a] );//modelを移動
modelS[a]->Draw();//modelを描画
//衝突中のモデルを回転させる
for (int b = a+1 ; b < 4; ++b)
{
if (modelS[a]->Hit(modelS[b]))
{
modelS[a]->Rotate(0.1);
modelS[b]->Rotate(0.1);
break;
}
}
}
if (Input::key.Return.on){ break;}//Enterで終了
}
return true;
}

Constructor & Destructor Documentation

SDX::SpFrame::SpFrame ( const IFrame 描画する枠)

コンストラクタ.

Member Function Documentation

void SDX::SpFrame::Draw ( const IShape 図形)
overridevirtual

ISpriteを描画する.

Implements SDX::ISprite.

void SDX::ISprite::SetZoom ( double  X拡大率,
double  Y拡大率 
)
inherited

表示倍率を設定.

void SDX::ISprite::MultiZoom ( double  倍率)
inherited

拡大率を掛け算する.

void SDX::ISprite::MultiZoom ( double  X倍率,
double  Y倍率 
)
inherited

縦横別で拡大率を掛け算する.

double SDX::ISprite::GetZoomX ( )
inherited

横方向の表示倍率を取得.

double SDX::ISprite::GetZoomY ( )
inherited

縦方向の表示倍率を取得.

double SDX::ISprite::GetAngle ( )
inherited

表示角度を取得.

void SDX::ISprite::SetAngle ( double  角度)
inherited

表示角度を設定.

void SDX::ISprite::Rotate ( double  回転する角度)
inherited

回転させる.

virtual void SDX::ISprite::Update ( )
virtualinherited

Anime等の更新処理.

Reimplemented in SDX::SpAnime.