SDXFrameWork 0.13 SDXFrameWork

- Main Page
- Related Pages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
SDX::SPEED::Liner Class Reference

常に同じ速度. More...

`#include <Speed.h>`

Inherits SDX::SPEED::ISpeed.

## Public Member Functions
| Liner (double 速度)
| 速度を指定する. More...
double | Get () const override
| 現在の速度を取得. More...
double | Update () override
| 速度を更新. More...

## Detailed Description

常に同じ速度.

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//速度オブジェクトを使う
#include <SDXFramework.h>
bool SampleSpeed()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
//位置と形を持った型
std::vector<std::shared_ptr<IShape>> shapes;
shapes.emplace_back(new Circle(0, 50, 10));
shapes.emplace_back(new Rect(0, 150, 20, 20));
shapes.emplace_back(new Line(0, 250, PAI / 2, 20, 5));
//変化する数値を表す型
std::vector<std::shared_ptr<SPEED::ISpeed>> speeds;
speeds.emplace_back(new SPEED::Liner(1));//等速
speeds.emplace_back(new SPEED::Accel(0, 0.01));//加速する
speeds.emplace_back(new SPEED::Wave(2, 0.1, 0));//平均√2で進む
while (System::Update())
{
for (int a = 0; a < 3; ++a)
{
//速度を更新する
speeds[a]->Update();
//図形を移動させる
shapes[a]->MoveA(speeds[a]->Get(), 0);
//描画する
shapes[a]->Draw(Color::White);
}
if (Input::key.Return.on){ break;}//Enterで終了
}
System::End();
return true;
}

## Constructor & Destructor Documentation

SDX::SPEED::Liner::Liner | ( | double | 速度 | ) |
| inline

速度を指定する.

## Member Function Documentation

double SDX::SPEED::Liner::Get | ( |  | ) | const
| inline override virtual

現在の速度を取得.

Implements SDX::SPEED::ISpeed.

double SDX::SPEED::Liner::Update | ( |  | ) |
| inline override virtual

速度を更新.

Implements SDX::SPEED::ISpeed.