SDXFrameWork  0.04
SDXFrameWork
 全て クラス ネームスペース 関数 変数 ページ
Public メソッド | Public 変数 | Static Protected メソッド | Protected 変数 | すべてのメンバ一覧
クラス SDX::Point

点を表す図形クラス. [詳細]

#include <Shape.h>

SDX::Shapeを継承しています。

Public メソッド

 Point (double x, double y)
 
ShapeClone (double x, double y) const
 同じ形の図形を作る. [詳細]
 
void SetPos (double x, double y)
 指定座標に移動. [詳細]
 
void Move (double mX, double mY)
 相対座標で移動. [詳細]
 
double GetX () const
 X座標を取得. [詳細]
 
double GetY () const
 Y座標を取得. [詳細]
 
double GetW () const
 幅を取得. [詳細]
 
double GetH () const
 高さを取得. [詳細]
 
void MultiZoom (double rateX, double rateY)
 縦横別で拡大率を掛け算する. [詳細]
 
void Rotate (double angle)
 回転する. [詳細]
 
void SetAngle (double angle)
 角度を指定する. [詳細]
 
void Draw (Color rgb, int transRate, Camera *camera=0) const
 描画する. [詳細]
 
bool Hit (const Shape *shape) const
 衝突判定. [詳細]
 
bool Hit (const Complex *complex) const
 
bool Hit (const Point *point) const
 
bool Hit (const Line *line) const
 
bool Hit (const Rect *rect) const
 
bool Hit (const Circle *circle) const
 
void SetZoom (double X拡大率, double Y拡大率)
 拡大率を設定. [詳細]
 
void MultiZoom (double 倍率)
 拡大率を掛け算する. [詳細]
 
void MoveA (double 距離, double 方向)
 極座標で移動. [詳細]
 
double GetDirect (Shape *比較対象)
 対象との角度を取得. [詳細]
 
double GetDistance (Shape *比較対象)
 対象との相対座標を取得. [詳細]
 

Public 変数

double x
 
double y
 

Static Protected メソッド

static bool RectRect (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 矩形の交差判定. [詳細]
 
static bool LineLine (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
 線分の交差判定. [詳細]
 
static int PointPoint (double x1, double y1, double x2, double y2)
 二点間の距離を計算. [詳細]
 

Protected 変数

double zoomX
 
double zoomY
 

説明

点を表す図形クラス.

//図形の当たり判定をする
bool SampleShape()
{
using namespace SDX;
System::Initialise("sample", 600, 400);
//図形を宣言する
Circle circle(10, 10, 100);
Rect rect(10, 10, 100, 100);
Line line(200, 100, PAI / 4, 600, 5);
//共通のインターフェースを持っている
Shape* 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);
//ダブルディスパッチによる当たり判定
bool isHit[3];
isHit[0] = circle.Hit(&rect) || circle.Hit(&line);
isHit[1] = shapes[1]->Hit(shapes[0]) || shapes[1]->Hit(shapes[2]);
isHit[2] = shapes[2]->Hit(shapes[0]) || shapes[2]->Hit(shapes[1]);
for (int i = 0; i < 3;++i )
{
if (isHit[i])
{
shapes[i]->Draw(Color::Red,255);
}
else
{
shapes[i]->Draw(Color::White, 255);
}
}
if (Input::key.Return.on) break;//Enterで終了
}
return true;
}

関数

Shape* SDX::Point::Clone ( double  x,
double  y 
) const
virtual

同じ形の図形を作る.

SDX::Shapeを実装しています。

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

指定座標に移動.

SDX::Shapeを実装しています。

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

相対座標で移動.

SDX::Shapeを実装しています。

double SDX::Point::GetX ( ) const
virtual

X座標を取得.

SDX::Shapeを実装しています。

double SDX::Point::GetY ( ) const
virtual

Y座標を取得.

SDX::Shapeを実装しています。

double SDX::Point::GetW ( ) const
virtual

幅を取得.

SDX::Shapeを実装しています。

double SDX::Point::GetH ( ) const
virtual

高さを取得.

SDX::Shapeを実装しています。

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

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

SDX::Shapeを実装しています。

void SDX::Point::Rotate ( double  angle)
virtual

回転する.

SDX::Shapeを実装しています。

void SDX::Point::SetAngle ( double  angle)
virtual

角度を指定する.

SDX::Shapeを実装しています。

void SDX::Point::Draw ( Color  rgb,
int  transRate,
Camera camera = 0 
) const
virtual

描画する.

SDX::Shapeを実装しています。

bool SDX::Point::Hit ( const Shape shape) const
virtual

衝突判定.

SDX::Shapeを実装しています。

static bool SDX::Shape::RectRect ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)
staticprotectedinherited

矩形の交差判定.

static bool SDX::Shape::LineLine ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
double  x4,
double  y4 
)
staticprotectedinherited

線分の交差判定.

static int SDX::Shape::PointPoint ( double  x1,
double  y1,
double  x2,
double  y2 
)
staticprotectedinherited

二点間の距離を計算.

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

拡大率を設定.

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

拡大率を掛け算する.

void SDX::Shape::MoveA ( double  距離,
double  方向 
)
inherited

極座標で移動.

double SDX::Shape::GetDirect ( Shape 比較対象)
inherited

対象との角度を取得.

double SDX::Shape::GetDistance ( Shape 比較対象)
inherited

対象との相対座標を取得.