SDXFrameWork  0.13
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
SDX::MOTION::Bound< TSpeed > Class Template Reference

範囲内で跳ね返る. More...

#include <Motion.h>

Inherits SDX::MOTION::IMotion.

Public Member Functions

 Bound (const TSpeed &速度, const Rect &移動範囲, double 進行方向)
 速度と移動範囲、最初の移動方向を指定. More...
 
bool Update (IPosition *移動対象) override
 Motion終了時はfalseを返す. More...
 

Detailed Description

template<class TSpeed>
class SDX::MOTION::Bound< TSpeed >

範囲内で跳ね返る.

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//ライブラリの初期化等を行う
#include <SDXFramework.h>
bool SampleMotion()
{
using namespace SDX;
System::Initialise("sample", 640, 480);//ウィンドウタイトルを指定して、初期化する
Line line(100, 50, 0.1, 20, 5);
Rect rect(100, 100, 10, 10 , 10 , 10);
Circle circleA(200, 150, 10);
Circle circleB(400, 400-30, 10);
Circle circleC(400, 400, 10);
MOTION::ToFront<SPEED::Wave> toFront({ 5, 0.1, 0 });
MOTION::Bound<SPEED::Liner> bound({ 5 }, {0,0,640,480},PAI/6);
MOTION::ToPoint<SPEED::Accel> toPoint({ -1.0, 0.01 }, {400,400});
MOTION::Orbit<SPEED::AccelLimit> orbit({ 0 , 0.001, 0.2 },50,30);
MOTION::Vibrate vibrate( 5 );
IShape* shapeS[5] = {&line,&rect,&circleA,&circleB,&circleC};
MOTION::IMotion *motionS[5] = {&toFront,&bound,&toPoint,&orbit,&vibrate};
while (System::Update())//ウィンドウの更新や、入力の更新等を行う
{
for (int a = 0; a < 5; ++a)
{
motionS[a]->Update(shapeS[a]);
shapeS[a]->Draw(Color::White);
}
if (Input::key.Return.on){ break;}//Enterで終了
}
System::End();//ライブラリの終了処理を行う
return true;
}

Constructor & Destructor Documentation

template<class TSpeed >
SDX::MOTION::Bound< TSpeed >::Bound ( const TSpeed &  速度,
const Rect 移動範囲,
double  進行方向 
)
inline

速度と移動範囲、最初の移動方向を指定.

Member Function Documentation

template<class TSpeed >
bool SDX::MOTION::Bound< TSpeed >::Update ( IPosition 移動対象)
inlineoverridevirtual

Motion終了時はfalseを返す.

Reimplemented from SDX::MOTION::IMotion.