SDXFrameWork 0.12 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 | Public Attributes | List of all members
SDX::Point Class Reference

点を表す図形クラス. More...

`#include <Point.h>`

Inherits SDX::IShape.

## Public Member Functions
| Point (double X座標, double Y座標)
| コンストラクタ. More...
template<class TA , class TB >
| Point (TA X座標, TB Y座標)
| コンストラクタ. More...
IShape * | Clone (double X座標, double Y座標) const override
| 同じ形の図形を作る. More...
void | SetPos (double X座標, double Y座標) override
| 指定座標に移動. More...
void | Move (double X移動量, double Y移動量) override
| 相対座標で移動. More...
double | GetX () const override
| X座標を取得. More...
double | GetY () const override
| Y座標を取得. More...
double | GetW () const override
| 幅を取得. More...
double | GetH () const override
| 高さを取得. More...
void | MultiZoom (double X倍率, double Y倍率) override
| 縦横別で拡大率を掛け算する. More...
void | Rotate (double 回転する角度) override
| 回転する. More...
void | Draw (const Color &描画色) const override
| 描画する. More...
bool | Hit (const IShape *shape) const override
| 衝突判定. More...
bool | Hit (const Complex *complex) const override
| 衝突判定. More...
bool | Hit (const Point *point) const override
| 衝突判定. More...
bool | Hit (const Line *line) const override
| 衝突判定. More...
bool | Hit (const Rect *rect) const override
| 衝突判定. More...
bool | Hit (const Circle *circle) const override
| 衝突判定. More...
| operator SDL_Point () const
| SDL_Pointに型変換. More...
Point | operator+ (const Point &加算値)
| 座標の加算. More...
Public Member Functions inherited from SDX::IPosition
void | SetZoom (double X拡大率, double Y拡大率)
| 拡大率を設定. More...
void | MultiZoom (double 倍率)
| 拡大率を掛け算する. More...
void | MoveA (double 距離, double 方向)
| 極座標で移動. More...
void | MoveF (double 距離)
| 前方に移動. More...
virtual double | GetAngle () const
| 角度を取得する. More...
void | SetAngle (double 指定角度)
| 角度を指定する. More...
double | GetDirect (IPosition *比較対象) const
| 対象との角度を取得. More...
double | GetDistance (IPosition *比較対象) const
| 対象との相対座標を取得. More...
virtual void | SetZoom (double X拡大率, double Y拡大率)
| 拡大率を設定. More...
void | MultiZoom (double 倍率)
| 拡大率を掛け算する. More...
void | MoveA (double 距離, double 方向)
| 極座標で移動. More...
virtual double | GetAngle () const
| 角度を取得する. More...
virtual void | SetAngle (double 指定角度)
| 角度を指定する. More...
double | GetDirect (IPosition *比較対象) const
| 対象との角度を取得. More...
double | GetDistance (IPosition *比較対象) const
| 対象との相対座標を取得. More...
double | CompareAngle (double 角度)
| 角度の差を計算する

## Public Attributes
double | x = 0
| 座標
double | y = 0
| 座標

## Additional Inherited Members
Static Protected Member Functions inherited from SDX::IShape
static bool | RectRect (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
| 矩形の交差判定. More...
static bool | LineLine (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
| 線分の交差判定. More...
static int | PointPoint (double x1, double y1, double x2, double y2)
| 二点間の距離を計算. More...
Protected Attributes inherited from SDX::IPosition
double | zoomX = 1
| 図形の拡大率
double | zoomY = 1
| 図形の拡大率

## Detailed Description

点を表す図形クラス.

//Copyright © 2014 SDXFramework
//[License]GNU Affero General Public License, version 3
//[Contact]http://sourceforge.jp/projects/dxframework/
//図形の当たり判定をする
#include <SDXFramework.h>
bool SampleShape()
{
using namespace SDX;
System::Initialise("sample", 640, 480);
//図形を宣言する
Circle circle(10, 10, 100);
Rect rect(60, 60, 100, 100);
Line line(200, 100, PAI / 4, 600, 5);
//共通のインターフェースを持っている
IShape* shapes[3];
shapes[0] = &circle;
shapes[1] = &rect;
shapes[2] = &line;
while (System::Update())
{
circle.SetPos(Input::mouse.x, Input::mouse.y);
//Lineは回転可能
line.Rotate(0.01);
//ダブルディスパッチによる当たり判定
for (int a = 0; a < 3; ++a)
{
int hit = 0;
for (int b = 0; b < 3; ++b)
{
if (a == b){ continue; }
hit += shapes[a]->Hit(shapes[b]);
}
if ( hit == 0)
{
shapes[a]->Draw(Color::White);
}
else if (hit == 1)
{
shapes[a]->Draw(Color::Red);
}
else
{
shapes[a]->Draw(Color::Blue);
}
}
if (Input::key.Return.on){ break;}//Enterで終了
}
System::End();
return true;
}

## Constructor & Destructor Documentation

SDX::Point::Point | ( | double | X座標,
|  | double | Y座標
| ) |  |
| inline

コンストラクタ.

template<class TA , class TB >

SDX::Point::Point | ( | TA | X座標,
|  | TB | Y座標
| ) |  |
| inline

コンストラクタ.

## Member Function Documentation

IShape* SDX::Point::Clone | ( | double | x,
|  | double | y
| ) |  | const
| inline override virtual

同じ形の図形を作る.

Implements SDX::IShape.

void SDX::Point::SetPos | ( | double | X座標,
|  | double | Y座標
| ) |  |
| inline override virtual

指定座標に移動.

Implements SDX::IPosition.

void SDX::Point::Move | ( | double | X移動量,
|  | double | Y移動量
| ) |  |
| inline override virtual

相対座標で移動.

Implements SDX::IPosition.

double SDX::Point::GetX | ( |  | ) | const
| inline override virtual

X座標を取得.

Implements SDX::IPosition.

double SDX::Point::GetY | ( |  | ) | const
| inline override virtual

Y座標を取得.

Implements SDX::IPosition.

double SDX::Point::GetW | ( |  | ) | const
| inline override virtual

幅を取得.

Implements SDX::IPosition.

double SDX::Point::GetH | ( |  | ) | const
| inline override virtual

高さを取得.

Implements SDX::IPosition.

void SDX::Point::MultiZoom | ( | double | X倍率,
|  | double | Y倍率
| ) |  |
| inline override virtual

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

Implements SDX::IPosition.

void SDX::Point::Rotate | ( | double | 回転する角度 | ) |
| inline override virtual

回転する.

Implements SDX::IPosition.

void SDX::Point::Draw | ( | const Color & | 描画色 | ) | const
| override virtual

描画する.

Implements SDX::IShape.

bool SDX::Point::Hit | ( | const IShape * | iShape | ) | const
| inline override virtual

衝突判定.

Implements SDX::IShape.

bool SDX::Point::Hit | ( | const Complex * | complex | ) | const
| inline override virtual

衝突判定.

Implements SDX::IShape.

bool SDX::Point::Hit | ( | const Point * | point | ) | const
| inline override virtual

衝突判定.

Implements SDX::IShape.

bool SDX::Point::Hit | ( | const Line * | line | ) | const
| override virtual

衝突判定.

Implements SDX::IShape.

bool SDX::Point::Hit | ( | const Rect * | rect | ) | const
| override virtual

衝突判定.

Implements SDX::IShape.

bool SDX::Point::Hit | ( | const Circle * | circle | ) | const
| override virtual

衝突判定.

Implements SDX::IShape.

SDX::Point::operator SDL_Point | ( |  | ) | const
| inline

SDL_Pointに型変換.

Point SDX::Point::operator+ | ( | const Point & | 加算値 | ) |
| inline

座標の加算.