From e57ec1d198abf22f89385424d891cd432bad06bb Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 20 Sep 2015 14:16:50 +0100 Subject: [PATCH] Added Win32 support for a future release. --- source/tools/bitmapcode.cpp | 47 ++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/source/tools/bitmapcode.cpp b/source/tools/bitmapcode.cpp index f7eecc1..b5e6cf8 100644 --- a/source/tools/bitmapcode.cpp +++ b/source/tools/bitmapcode.cpp @@ -80,8 +80,18 @@ void CreateCPPFile(wxString dirfilename, wxString PNGFilename, int* counter) // Setup the PNG file reading and cpp file. fstream cppfile, pngfile; + +#if defined(__WIN32__) + pngfile.open(PNGFilename.wc_str(), ios::in | ios::binary ); - cppfile.open(CPPFilename.wc_str(), ios::out | ios::trunc ); + cppfile.open(CPPFilename.wc_str(), ios::out | ios::trunc ); + +# else + + pngfile.open(PNGFilename.c_str(), ios::in | ios::binary ); + cppfile.open(CPPFilename.c_str(), ios::out | ios::trunc ); + +#endif outname.Append(wxString::FromUTF8(DirFilenameOnly.c_str())); outname.Append(wxT("_")); @@ -174,9 +184,7 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, wxString HPPFilenameOnly; wxString CPPFilename; -#if defined(__HAIKU__) - -#elif defined(__WIN32__) +#if defined(__WIN32__) wxStringTokenizer HPPFilenameTokens(HPPFilename, wxT("\\")); wxStringTokenizer DirFilenameTokens(dirfilename, wxT("\\")); @@ -212,8 +220,16 @@ void CreateHPPFileDir(wxString dirfilename, wxArrayString filelist, HPPFilename.Append(wxT(".h")); +#if defined(__WIN32__) + hppfile.open(HPPFilename.wc_str(), ios::out | ios::trunc ); - + +#else + + hppfile.open(HPPFilename.c_str(), ios::out | ios::trunc ); + +#endif + hppfile << "#include " << endl << endl; hppfile << "#ifndef " << finaldirname.c_str() << "_H" << endl; hppfile << "#define " << finaldirname.c_str() << "_H" << endl << endl; @@ -333,8 +349,8 @@ int main(int argc, char *argv[]) #else - BitmapFilename.Append(BitmapDirName); - BitmapFilename.Append(wxT("/../bitmaps.h")); + BitmapHeaderFilename.Append(BitmapDirName); + BitmapHeaderFilename.Append(wxT("/../bitmaps.h")); #endif @@ -351,7 +367,7 @@ int main(int argc, char *argv[]) wxString BitmapSubDirFull; bool ContinueProcess = BitmapDir.GetFirst(&BitmapSubDir, wxEmptyString, wxDIR_DEFAULT); - + while (ContinueProcess){ #if defined(__HAIKU__) @@ -369,7 +385,7 @@ int main(int argc, char *argv[]) BitmapSubDirFull.Append(BitmapDirName); BitmapSubDirFull.Append(wxT("/")); - BitmapSubDirFull.Append(BitmapSubDirFull); + BitmapSubDirFull.Append(BitmapSubDir); #endif @@ -418,15 +434,24 @@ int main(int argc, char *argv[]) std::cout << BitmapHeaderFilename.c_str() << std::endl; +#if defined(__WIN32__) + finalhppfile.open(BitmapHeaderFilename.wc_str(), ios::out | ios::trunc); + +#else + + finalhppfile.open(BitmapHeaderFilename.c_str(), ios::out | ios::trunc); + +#endif + finalhppfile << "#include " << endl << endl; finalhppfile << "#ifndef BITMAPS_H" << endl; finalhppfile << "#define BITMAPS_H" << endl << endl; - + for (int bi = 0; bi < dirlist.GetCount(); bi++) { - wxString BitmapSubDirName = wxString::FromUTF8(dirlist[bi]); + wxString BitmapSubDirName = dirlist[bi]; wxString BitmapFilename; wxDir BitmapSubDir(BitmapSubDirName); -- 2.39.5