5 #include <Multimedia/SDX.h>
6 #include <Multimedia/Image.h>
7 #include <Multimedia/Loading.h>
8 #include <Tiled/GetTag.h>
9 #include <Multimedia/File.h>
27 ImagePack(
const char *ファイル名,
int 総コマ数,
int コマ割り横,
int コマ割り縦)
35 ImagePack(
const char *ファイル名,
const char *拡張子,
int 総コマ数,
const char* 書式 =
"%03d.")
37 Load(ファイル名, 拡張子, 総コマ数, 書式);
47 bool Load(
const char *ファイル名,
int 総コマ数,
int コマ割り横,
int コマ割り縦)
49 if (Loading::isLoading)
55 int x = 0, y = 0, count = 0;
58 const int width = image.
GetWidth() / コマ割り横;
59 const int height = image.
GetHeight() / コマ割り縦;
61 for (
int a = 0; a < コマ割り縦; ++a)
64 for (
int b = 0; b < コマ割り横; ++b)
66 if (count >= 総コマ数)
break;
67 this->
Add(
new Image(image, { x, y, width, height }));
80 bool Load(
const char *ファイル名,
const char *拡張子,
int 総コマ数,
const char* 書式 =
"%03d.")
82 if (Loading::isLoading)
88 for (
int a = 0; a < 総コマ数; ++a)
91 sprintf_s(fileBuf, 8, 書式, a);
93 std::string fileName = ファイル名;
97 this->
Add(
new Image(fileName.c_str()));
105 if (Loading::isLoading)
131 for (
auto & str : strS)
133 if (str.find(
"<objectgroup") != std::string::npos)
138 else if (str.find(
"<tileset") != std::string::npos)
140 tileW = std::atoi(GetTag(str,
"tilewidth=").c_str());
141 tileH = std::atoi(GetTag(str,
"tileheight=").c_str());
143 else if (str.find(
"<image width") != std::string::npos)
145 std::string sttt = GetTag(str,
"source=");
147 imageS.push_back(
new Image(GetTag(str,
"source=").c_str()) );
149 else if (str.find(
"<image source") != std::string::npos)
151 int w = std::atoi(GetTag(str,
"width=").c_str()) / tileW;
152 int h = std::atoi(GetTag(str,
"height=").c_str()) / tileH;
154 Load(GetTag(str,
"source=").c_str(), w*h, w, h);
169 void Add(
const char *ファイル名)
188 return (
int)
imageS.size();
217 if (Loading::isLoading)
223 for (
unsigned int a = 0; a < 幅.size();++a)
225 imageS[a]->part.w -= 幅[a];
int widthMax
最大幅
Definition: ImagePack.h:21
Image * operator[](int index) const
オペレータ.
Definition: ImagePack.h:236
ImagePack(const char *ファイル名, const char *拡張子, int 総コマ数, const char *書式="%03d.")
連番ファイルを一括して読み込む.
Definition: ImagePack.h:35
virtual void Release()
Imageをメモリから開放.
Definition: ImagePack.h:175
int GetWidth() const
最大幅を取得.
Definition: ImagePack.h:192
std::vector< Image * > imageS
保持するImage
Definition: ImagePack.h:20
入出力可能なテキストかバイナリファイルを表すクラス.
Definition: File.h:29
std::vector< std::string > GetLineS()
ファイルを改行区切りで一括して読み込む.
Definition: File.h:390
bool LoadTmx(const char *tmxファイル名)
tmxファイルのタイルセット情報を元に画像を読み込む.
Definition: ImagePack.h:103
auto end() -> decltype(imageS.end())
イテレータ用.
Definition: ImagePack.h:248
bool Load(const char *ファイル名, const char *拡張子, int 総コマ数, const char *書式="%03d.")
連番ファイルを一括して読み込む.
Definition: ImagePack.h:80
画像データを表すクラス.
Definition: Image.h:17
Image * operator[](int index)
オペレータ.
Definition: ImagePack.h:230
色を表すクラス.
Definition: Color.h:11
void Add(const char *ファイル名)
Imageを末尾に追加.
Definition: ImagePack.h:169
FileMode GetFileMode()
ファイルモードを取得.
Definition: File.h:135
bool Load(const char *ファイル名, int 総コマ数, int コマ割り横, int コマ割り縦)
1つの画像を分割して読み込む.
Definition: ImagePack.h:47
static void AddLoading(std::function< void(void)> &&読み込み関数)
非同期読み込み処理に追加.
Definition: Loading.h:96
int GetHeight() const
高さを取得.
Definition: Image.h:310
int GetWidth() const
幅を取得.
Definition: Image.h:304
void AdjustWidth(std::vector< int > 幅)
先頭からimageの幅を差分修正.
Definition: ImagePack.h:215
int GetSize() const
要素数を取得.
Definition: ImagePack.h:186
auto end() const -> decltype(imageS.end())
イテレータ用.
Definition: ImagePack.h:260
auto begin() -> decltype(imageS.begin())
イテレータ用.
Definition: ImagePack.h:242
int GetHeight() const
最大高さを取得.
Definition: ImagePack.h:198
ImagePack(const char *ファイル名, int 総コマ数, int コマ割り横, int コマ割り縦)
1つの画像を分割して読み込む.
Definition: ImagePack.h:27
複数のImageをまとめるクラス.
Definition: ImagePack.h:17
void Add(Image *追加イメージ)
Imageを末尾に追加.
Definition: ImagePack.h:162
int heightMax
最大高さ
Definition: ImagePack.h:22
void SetColor(const Color &描画色)
描画色をまとめて変更.
Definition: ImagePack.h:204
auto begin() const -> decltype(imageS.begin())
イテレータ用.
Definition: ImagePack.h:254