SDXFrameWork  0.04
SDXFrameWork
 全て クラス ネームスペース 関数 変数 ページ
BmpFrame.h
1 #pragma once
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 
11 class IFrame
13 {
14 public:
15  virtual void Draw(int X座標, int Y座標, int 幅, int 高さ) const = 0;
16 };
17 
19 class BmpFrame : public IFrame
21 {
22 private:
23  bool isMake;
24  int frameWidth;
25  int frameHeight;
26  ImagePack *frame;
27  Image *skinn;
28 public:
30  bool Make( ImagePack *外枠 , Image *内側スキン = nullptr )
33  {
34  if( 外枠->GetSize() != 9 ) return false;
35 
36  if( 内側スキン == nullptr )
37  {
38  this->skinn = 外枠[0][4];
39  }else{
40  this->skinn = 内側スキン;
41  }
42 
43  this->frame = 外枠;
44 
45  this->isMake = true;
46 
47  this->frameWidth = 外枠->GetWidth();
48  this->frameHeight = 外枠->GetHeight();
49 
50  return true;
51  }
52 
54  void Draw( int X座標, int Y座標, int 幅, int 高さ) const
56  {
57  const int xA = X座標 + this->frameWidth;
58  const int xB = X座標 - this->frameWidth + 幅;
59  const int yA = Y座標 + this->frameHeight;
60  const int yB = Y座標 - this->frameHeight + 高さ;
61 
62  //内部スキンを描画
63  skinn->DrawExtend(X座標 + 6, Y座標 + 6, X座標 + 幅 - 6, Y座標 + 高さ - 6);
64 
65  //まず外枠を描画
66  frame[0][3]->DrawExtend(X座標, yA, xA, yB);
67  frame[0][5]->DrawExtend(xB, yA, xB + this->frameWidth, yB);
68 
69  frame[0][1]->DrawExtend(xA, Y座標, xB, yA);
70  frame[0][7]->DrawExtend(xA, yB, xB, yB + this->frameHeight);
71 
72  //四隅を描画
73  frame[0][0]->Draw(X座標, Y座標);
74  frame[0][2]->Draw(X座標 + 幅 - this->frameWidth, Y座標);
75  frame[0][6]->Draw(X座標, Y座標 + 高さ - this->frameHeight);
76  frame[0][8]->Draw(X座標 + 幅 - this->frameWidth, Y座標 + 高さ - this->frameHeight);
77  }
78 };
79 }
void Draw(int X座標, int Y座標, int 幅, int 高さ) const
矩形のフレームを描画.
Definition: BmpFrame.h:55
bool Make(ImagePack *外枠, Image *内側スキン=nullptr)
フレームを作成する.
Definition: BmpFrame.h:32
bool DrawExtend(int X座標A, int Y座標A, int X座標B, int Y座標B) const
指定矩形内に描画.
Definition: Image.h:233