// DxLid.h の 26行め辺り
// #define DX_USE_VISUALC_MEM_DEBUG の、コメントを外す
#include <map>
#include <string>
// PathMatchSpec
#include <shlwapi.h>
#pragma comment(lib,"shlwapi.lib")
std::map <std::string, int> gPicture;
// 指定したホルダ内に入っている場合
// gPicture["画像名"]
// gPicture["abc.png"]の様に拡張子も必要
//
// 指定したホルダのホルダに入っている場合
// gPicture["フォルダ名/画像名"]
// name : ホルダー名を指定
// pass : 使用しない
//
// 例 /を忘れずに
// ReadingPicture("icon/");
void ReadingPicture(const char *name, const char *pass = ""){
FILEINFO lp;
std::string Pattern = name;
Pattern += "*";
int hFind = FileRead_findFirst(Pattern.c_str(), &lp);
if(hFind == -1){ return; }
do{
if(!lp.DirFlag){
// 拡張子の識別
if(PathMatchSpec( lp.Name, "*.bmp") || PathMatchSpec( lp.Name, "*.png") || PathMatchSpec( lp.Name, "*.jpg")){
std::string sub = name;
sub += lp.Name;
std::string str = pass;
str += lp.Name;
// 画像データーの獲得
gPicture[str.c_str()] = LoadGraph( sub.c_str() );
}
}else if(strcmp(lp.Name,"..") && strcmp(lp.Name,".")){
std::string sub = name;
sub += lp.Name ;
sub += "/";
std::string str = pass;
str += lp.Name;
str += "/";
// ホルダの中のホルダ
ReadingPicture(sub.c_str(), str.c_str());
}
} while(!FileRead_findNext(hFind, &lp));
FileRead_findClose(hFind);
}
一例ですけど、こんな感じだと思います。
手抜きしたい時には便利かも知れませんね。
分割とかは自力で対応して下さいね。