SDXFrameWork  0.09
SDXFrameWork
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
BmpFrame.h
1 #pragma once//©SDXFramework http://sourceforge.jp/projects/dxframework/
2 #include <Multimedia/Image.h>
3 #include <Multimedia/Font.h>
4 #include <Framework/BmpFont.h>
5 #include <Framework/Anime.h>
6 
7 namespace SDX
8 {
9 
12 class IFrame
13 {
14 public:
15  virtual void Draw(const Rect &領域) const = 0;
16 };
17 
20 class BmpFrame : public IFrame
21 {
22 private:
23  bool isMake;
24  ImagePack *frame;
25 public:
28  bool Make( ImagePack *フレーム画像 )
29  {
30  if( フレーム画像->GetSize() != 9 ) return false;
31 
32  this->frame = フレーム画像;
33  this->isMake = true;
34 
35  return true;
36  }
37 
40  void Draw(const Rect &領域) const
41  {
42  const int fWidth = frame->GetWidth();
43  const int fHeight = frame->GetHeight();
44 
45  const double X座標 = 領域.GetLeft();
46  const double Y座標 = 領域.GetTop();
47  const double xA = X座標 + fWidth;
48  const double xB = X座標 - fWidth + 領域.GetW();
49  const double yA = Y座標 + fHeight;
50  const double yB = Y座標 - fHeight + 領域.GetH();
51 
52  //内部スキンを描画
53  frame[0][4]->DrawExtend({ fWidth +X座標, fHeight + Y座標}, { 領域.GetW() - fWidth + X座標, 領域.GetH() - fHeight + Y座標});
54 
55  //まず外枠を描画
56  frame[0][3]->DrawExtend({ X座標, yA }, { xA, yB });
57  frame[0][5]->DrawExtend({ xB, yA }, { xB + fWidth, yB });
58 
59  frame[0][1]->DrawExtend({ xA, Y座標 }, { xB, yA });
60  frame[0][7]->DrawExtend({ xA, yB }, { xB, yB + fHeight });
61 
62  //四隅を描画
63  frame[0][0]->Draw({ X座標, Y座標 });
64  frame[0][2]->Draw({ X座標 + 領域.GetW() - fWidth, Y座標 });
65  frame[0][6]->Draw({ X座標, Y座標 + 領域.GetH() - fHeight });
66  frame[0][8]->Draw({ X座標 + 領域.GetW() - fWidth, Y座標 + 領域.GetH() - fHeight });
67  }
68 };
69 }
矩形を表す図形クラス.
Definition: Shape.h:536
double GetW() const
幅を取得.
Definition: Shape.h:616
int GetWidth() const
最大幅を取得.
Definition: ImagePack.h:107
bool Make(ImagePack *フレーム画像)
フレームを作成する.
Definition: BmpFrame.h:28
描画用枠を表すクラス.
Definition: BmpFrame.h:20
int GetSize() const
要素数を取得.
Definition: ImagePack.h:101
int GetHeight() const
最大高さを取得.
Definition: ImagePack.h:113
複数のImageをまとめるクラス.
Definition: ImagePack.h:9
描画用枠のインターフェース.
Definition: BmpFrame.h:12
void Draw(const Rect &領域) const
矩形のフレームを描画.
Definition: BmpFrame.h:40
double GetH() const
高さを取得.
Definition: Shape.h:621