SDXFrameWork 0.09 SDXFrameWork

- Main Page
- Related Pages
- Classes

All Classes Namespaces Functions Variables Enumerations Enumerator Pages
ShapeDraw.h
1 #pragma once//©SDXFramework http://sourceforge.jp/projects/dxframework/
2 #include <Multimedia/Drawing.h>
3
4 namespace SDX
5 {
6 void Complex::Draw(Color 描画色, int 透過率, Camera *座標変換Camera) const
7 {
8 for( auto it: shapes )
9 {
10 it->Draw(描画色, 透過率, 座標変換Camera);
11 }
12 }
13
14 void Point::Draw(Color 描画色, int 透過率, Camera *座標変換Camera) const
15 {
16 Screen::SetBlendMode(BlendMode::Alpha, 透過率);
17 if (座標変換Camera)
18 {
19 Drawing::Pixel(座標変換Camera->Trans({ x, y }), 描画色);
20 }
21 else
22 {
23 Drawing::Pixel({ x, y }, 描画色);
24 }
25 Screen::SetBlendMode(BlendMode::NoBlend, 透過率);
26 }
27
28 void Line::Draw(Color 描画色, int 透過率, Camera *座標変換Camera ) const
29 {
30 Screen::SetBlendMode(BlendMode::Alpha, 透過率);
31 if( 座標変換Camera )
32 {
33 Drawing::Line(座標変換Camera->Trans({xA,yA}), 座標変換Camera->Trans({xB,yB}), 描画色, (int)(座標変換Camera->GetZoom()));
34 Drawing::Circle({ 座標変換Camera->TransX(xA), 座標変換Camera->TransY(yA), thickHarf*座標変換Camera->GetZoom() }, 描画色, true);
35 Drawing::Circle({ 座標変換Camera->TransX(xB), 座標変換Camera->TransY(yB), thickHarf*座標変換Camera->GetZoom() }, 描画色, true);
36 }
37 else
38 {
39 Drawing::Line({xA,yA},{xB,yB}, 描画色, (int)thick);
40 Drawing::Circle({ xA, yA, thickHarf }, 描画色, true);
41 Drawing::Circle({ xB, yB, thickHarf }, 描画色, true);
42 }
43 Screen::SetBlendMode(BlendMode::NoBlend, 透過率);
44 }
45
46 void Rect::Draw( Color 描画色 , int 透過率 , Camera *座標変換Camera ) const
47 {
48 Screen::SetBlendMode(BlendMode::Alpha, 透過率);
49 if (座標変換Camera)
50 {
51 Drawing::Rect
52 (
53 {
54 座標変換Camera->TransX(x - widthLeft),
55 座標変換Camera->TransY(y - heightUp),
56 座標変換Camera->GetZoom() * GetW(),
57 座標変換Camera->GetZoom() * GetH()
58 },
59 描画色 ,
60 true
61 );
62 }
63 else
64 {
65 Drawing::Rect
66 (
67 {
68 x - widthLeft,
69 y - heightUp,
70 GetW() ,
71 GetH()
72 },
73 描画色 ,
74 true
75 );
76 }
77 Screen::SetBlendMode(BlendMode::NoBlend, 透過率);
78 }
79
80 void Circle::Draw( Color 描画色 , int 透過率 , Camera *座標変換Camera ) const
81 {
82 Screen::SetBlendMode(BlendMode::Alpha, 透過率);
83 if( 座標変換Camera )
84 {
85 Drawing::Circle({ 座標変換Camera->TransX(x), 座標変換Camera->TransY(y), radius * 座標変換Camera->GetZoom() }, 描画色, true);
86 }
87 else
88 {
89 Drawing::Circle({ x, y, radius }, 描画色, true);
90 }
91 Screen::SetBlendMode(BlendMode::NoBlend, 透過率);
92
93 }
94 };
SDX::Drawing::Circle
static void Circle(const Circle &円形, Color 色, bool 塗りつぶしフラグ)
中心と半径を指定して円を描画.
Definition: Drawing.h:107
SDX::Screen::SetBlendMode
static bool SetBlendMode(BlendMode ブレンドモード, int 設定値)
ブレンド描画のモードを設定.
Definition: Screen.h:132
SDX::Camera::TransY
double TransY(double Y座標変換前)
カメラの位置と拡大率に応じてY座標を変換.
Definition: Camera.h:152
SDX::Rect::GetW
double GetW() const
幅を取得.
Definition: Shape.h:616
SDX::Rect::Draw
void Draw(Color 描画色, int 透過率, Camera *座標変換Camera=nullptr) const
描画する.
Definition: ShapeDraw.h:46
SDX::Complex::Draw
void Draw(Color 描画色, int 透過率, Camera *座標変換Camera=nullptr) const
描画する.
Definition: ShapeDraw.h:6
SDX::Camera::TransX
double TransX(double X座標変換前)
カメラの位置と拡大率に応じてX座標を変換.
Definition: Camera.h:146
SDX::Line::Draw
void Draw(Color 描画色, int 透過率, Camera *座標変換Camera=nullptr) const
描画する.
Definition: ShapeDraw.h:28
SDX::Drawing::Pixel
static void Pixel(const Point &座標, Color 色)
指定座標に点を描画.
Definition: Drawing.h:132
SDX::Point::Draw
void Draw(Color 描画色, int 透過率, Camera *座標変換Camera=nullptr) const
描画する.
Definition: ShapeDraw.h:14
SDX::Circle::Draw
void Draw(Color 描画色, int 透過率, Camera *座標変換Camera=nullptr) const
描画する.
Definition: ShapeDraw.h:80
SDX::Color
色を表すクラス.
Definition: Color.h:7
SDX::Camera::GetZoom
double GetZoom()
拡大率を取得.
Definition: Camera.h:126
SDX::Camera
2D用に座標変換を行うカメラを表すクラス.
Definition: Camera.h:16
SDX::Drawing::Line
static bool Line(const Point &始点, const Point &終点, Color 色, int 太さ)
始点と終点を結ぶ直線を描画.
Definition: Drawing.h:86
SDX::Rect::GetH
double GetH() const
高さを取得.
Definition: Shape.h:621
SDX::Drawing::Rect
static bool Rect(const Rect &領域, Color 色, bool 塗りつぶしフラグ)
左上の座標と大きさを指定して矩形を描画.
Definition: Drawing.h:93