1 #pragma once//©SDXFramework http://sourceforge.jp/projects/dxframework/
2 #include<Multimedia/SDX.h>
3 #include<Multimedia/Image.h>
12 std::vector<Image*> images;
22 ImagePack(
const char *ファイル名 ,
int 総コマ数 ,
int コマ割り横,
int コマ割り縦)
34 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 a = 0; a < コマ割り縦; ++a)
45 for (
int b = 0; b < コマ割り横; ++b)
47 if (count >= 総コマ数)
break;
48 this->
Add(
new Image(image, x, y, width, height));
61 bool Load(
const char *ファイル名 ,
const char *拡張子 ,
int 総コマ数 ,
const char* 書式 =
"%03d.")
63 for(
int a=0 ; a<総コマ数 ; ++a)
66 sprintf_s( fileBuf , 8 , 書式 , a );
68 std::string fileName = ファイル名;
72 this->
Add(
new Image( fileName.c_str() ) );
80 images.push_back( 追加イメージ );
81 this->widthMax = std::max( this->widthMax , 追加イメージ->
GetWidth() );
82 this->heightMax = std::max( this->heightMax, 追加イメージ->
GetHeight());
84 void Add(
const char *ファイル名)
92 for(
auto it : images)
103 return (
int)images.size();
109 return this->widthMax;
115 return this->heightMax;
118 Image* operator[](
int index)
120 return images[index];
123 Image* operator[](
int index)
const
125 return images[index];
virtual void Release()
Imageをメモリから開放.
Definition: ImagePack.h:90
int GetWidth() const
最大幅を取得.
Definition: ImagePack.h:107
bool Load(const char *ファイル名, const char *拡張子, int 総コマ数, const char *書式="%03d.")
連番ファイルを一括して読み込む.
Definition: ImagePack.h:61
画像データを表すクラス.
Definition: Image.h:38
bool Load(const char *ファイル名, int 総コマ数, int コマ割り横, int コマ割り縦)
1つの画像を分割して読み込む.
Definition: ImagePack.h:34
int GetHeight() const
高さを取得.
Definition: Image.h:248
int GetWidth() const
幅を取得.
Definition: Image.h:242
int GetSize() const
要素数を取得.
Definition: ImagePack.h:101
int GetHeight() const
最大高さを取得.
Definition: ImagePack.h:113
ImagePack(const char *ファイル名, int 総コマ数, int コマ割り横, int コマ割り縦)
1つの画像を分割して読み込む.
Definition: ImagePack.h:22
複数のImageをまとめるクラス.
Definition: ImagePack.h:9
void Add(Image *追加イメージ)
Imageを末尾に追加.
Definition: ImagePack.h:78