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

Animeスプライト. More...

#include <Sprite.h>

Inherits SDX::ISprite.

Public Member Functions

 SpAnime (const Film *再生対象, double 再生速度=1)
 コンストラクタ. More...
 
void Update () override
 アニメの更新. More...
 
void Draw (const IShape &座標) const override
 ISpriteを描画する. More...
 
- Public Member Functions inherited from SDX::ISprite
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...
 

Additional Inherited Members

- Public Attributes inherited from SDX::ISprite
bool isTurn = false
 反転フラグ
 
Color color = { 255, 255, 255, 255 }
 描画色
 
Point gap = {0,0}
 Shape中心とSpriteとの位置差
 
Point axis = {0,0}
 回転軸のずれ
 
- Protected Attributes inherited from SDX::ISprite
double zoomX = 1
 描画倍率
 
double zoomY = 1
 描画倍率
 
double angle = 0
 角度
 

Detailed Description

Animeスプライト.

//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]->GetSprite().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::SpAnime::SpAnime ( const Film 再生対象,
double  再生速度 = 1 
)
inline

コンストラクタ.

Member Function Documentation

void SDX::SpAnime::Update ( )
inlineoverridevirtual

アニメの更新.

Reimplemented from SDX::ISprite.

void SDX::SpAnime::Draw ( const IShape 図形) const
inlineoverridevirtual

ISpriteを描画する.

Implements SDX::ISprite.