2 #include<Multimedia/SDX.h>
3 #include<Multimedia/Image.h>
12 std::vector<Image*> images;
22 ImagePack(
const char *ファイル名 ,
int 総コマ数 ,
int コマ割り横,
int コマ割り縦)
28 virtual bool Load(
const char *ファイル名 ,
int 総コマ数,
int コマ割り横,
int コマ割り縦 )
36 int x = 0, y = 0, count = 0;
39 const int width = image.GetWidth() / コマ割り横;
40 const int height = image.GetHeight() / コマ割り縦;
42 for (
int i = 0; i < コマ割り縦; ++i)
45 for (
int j = 0; j < コマ割り横; j++)
47 if (count >= 総コマ数)
break;
48 this->
Add(
new Image(image, x, y, width, height));
59 virtual bool Load(
const char *ファイル名 ,
const char *拡張子 ,
int 総コマ数 )
63 for(
int i=0 ; i<総コマ数 ; ++i)
66 sprintf_s( fileBuf , 8 ,
"%03d." , i );
68 std::string fileName = ファイル名;
72 this->
Add(
new Image( fileName.c_str() ) );
78 virtual void Add(Image *追加イメージ)
81 images.push_back( 追加イメージ );
82 this->widthMax = std::max( this->widthMax , 追加イメージ->GetWidth() );
83 this->heightMax = std::max( this->heightMax, 追加イメージ->GetHeight());
85 virtual void Add(
const char *ファイル名)
87 Add(
new Image( ファイル名 ) );
93 for(
auto it : images)
104 return images.size();
110 return this->widthMax;
116 return this->heightMax;
119 Image* operator[](
int index)
121 return images[index];
virtual void Add(Image *追加イメージ)
Imageを追加.
Definition: ImagePack.h:79
virtual void Release()
Imageをメモリから開放.
Definition: ImagePack.h:91
int GetWidth() const
最大幅を取得.
Definition: ImagePack.h:108
画像データを表すクラス.
Definition: Image.h:37
int GetSize() const
要素数を取得.
Definition: ImagePack.h:102
int GetHeight() const
最大高さを取得.
Definition: ImagePack.h:114
ImagePack(const char *ファイル名, int 総コマ数, int コマ割り横, int コマ割り縦)
1つの画像を分割して読み込む.
Definition: ImagePack.h:22
virtual bool Load(const char *ファイル名, int 総コマ数, int コマ割り横, int コマ割り縦)
1つの画像を分割して読み込む.
Definition: ImagePack.h:34