SDXFrameWork 0.12 SDXFrameWork

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Complex.h
1 //Copyright © 2014 SDXFramework
2 //[License]GNU Affero General Public License, version 3
3 //[Contact]http://sourceforge.jp/projects/dxframework/
4 #pragma once
5
6 #include <Framework/IShape.h>
7 namespace SDX
8 {
9 class Complex;
10 class Point;
11 class Line;
12 class Circle;
13 class Rect;
14
15 class Camera;
16 class Color;
17
20 class Complex : public IShape
21 {
22 public:
23 std::vector<IShape*> shapes;
24
25 Complex() = default;
26
28 Complex(IShape *shape)
29 {
30 shapes.push_back(shape);
31 }
32
33 IShape* Clone(double x, double y) const override
34 {
35 Complex *buf = new Complex();
36
37 for (auto it : shapes)
38 {
39 buf->shapes.push_back(it);
40 }
41
42 return buf;
43 }
44
45 void SetPos(double X座標, double Y座標) override
46 {
47 for (auto it : shapes)
48 {
49 it->SetPos(X座標, Y座標);
50 }
51 }
52
53 void Move(double X移動量, double Y移動量) override
54 {
55 for (auto it : shapes)
56 {
57 it->Move(X移動量, Y移動量);
58 }
59 }
60
61 double GetX() const override
62 {
63 return shapes[0]->GetX();
64 }
65
66 double GetY() const override
67 {
68 return shapes[0]->GetY();
69 }
70
71 double GetW() const override
72 {
73 return shapes[0]->GetW();
74 }
75
76 double GetH() const override
77 {
78 return shapes[0]->GetH();
79 }
80
81 void MultiZoom(double X倍率, double Y倍率) override
82 {
83 for (auto it : shapes)
84 {
85 it->MultiZoom(X倍率, Y倍率);
86 }
87 zoomX *= X倍率;
88 zoomY *= Y倍率;
89 }
90
91 void Rotate(double 回転する角度) override
92 {
93 for (auto it : shapes)
94 {
95 it->Rotate(回転する角度);
96 }
97 }
98
99 void Draw(const Color &描画色) const override;
100
101 bool Hit(const IShape *shape) const override
102 {
103 return shape->Hit(this);
104 }
105 bool Hit(const Complex *complex) const override
106 {
107 for (auto itA : this->shapes)
108 {
109 for (auto itB : complex->shapes)
110 {
111 if (itA->Hit(itB)) return true;
112 }
113 }
114 return false;
115 }
116 bool Hit(const Point *point) const override;
117 bool Hit(const Line *line) const override;
118 bool Hit(const Rect *rect) const override;
119 bool Hit(const Circle *circle) const override;
120 };
121 }
SDX::Complex::Complex
Complex(IShape *shape)
コンストラクタ.
Definition: Complex.h:28
SDX::Rect
矩形を表す図形クラス.
Definition: Rect.h:22
SDX::Complex::Rotate
void Rotate(double 回転する角度) override
回転する.
Definition: Complex.h:91
SDX::Line
太さのある線を表す図形クラス.
Definition: Line.h:20
SDX::Complex::Clone
IShape * Clone(double x, double y) const override
同じ形の図形を作る.
Definition: Complex.h:33
SDX::Complex::shapes
std::vector< IShape * > shapes
保持するShape
Definition: Complex.h:23
SDX::Complex::Move
void Move(double X移動量, double Y移動量) override
相対座標で移動.
Definition: Complex.h:53
SDX::Point
点を表す図形クラス.
Definition: Point.h:22
SDX::IShape
衝突判定可能な図形の抽象クラス.
Definition: IShape.h:21
SDX::IShape::Hit
virtual bool Hit(const IShape *iShape) const =0
衝突判定.
SDX::Complex::Draw
void Draw(const Color &描画色) const override
描画する.
Definition: ShapeDraw.h:10
SDX::Complex
複合図形を表すクラス.
Definition: Complex.h:20
SDX::Color
色を表すクラス.
Definition: Color.h:11
SDX::Complex::GetH
double GetH() const override
高さを取得.
Definition: Complex.h:76
SDX::Complex::GetY
double GetY() const override
Y座標を取得.
Definition: Complex.h:66
SDX::Complex::GetW
double GetW() const override
幅を取得.
Definition: Complex.h:71
SDX::Complex::Hit
bool Hit(const Complex *complex) const override
衝突判定.
Definition: Complex.h:105
SDX::IPosition::zoomX
double zoomX
図形の拡大率
Definition: IPosition.h:14
SDX::Complex::MultiZoom
void MultiZoom(double X倍率, double Y倍率) override
縦横別で拡大率を掛け算する.
Definition: Complex.h:81
SDX::Complex::SetPos
void SetPos(double X座標, double Y座標) override
指定座標に移動.
Definition: Complex.h:45
SDX::Circle
円を表す図形クラス.
Definition: Circle.h:20
SDX::IPosition::zoomY
double zoomY
図形の拡大率
Definition: IPosition.h:15
SDX::Complex::GetX
double GetX() const override
X座標を取得.
Definition: Complex.h:61
SDX::Complex::Hit
bool Hit(const IShape *shape) const override
衝突判定.
Definition: Complex.h:101