Added a win32 file chooser to the sdl build for lua loading.. Could someone please test this?

This commit is contained in:
punkrockguy318 2008-08-10 08:39:08 +00:00
parent 16617596df
commit 5b6db7c429
1 changed files with 24 additions and 0 deletions

View File

@ -152,6 +152,30 @@ std::string GetFilename()
std::string fname = "";
#ifdef WIN32
// TODO: WIN32 file chooser code goes here
OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
// Initialize OPENFILENAME
memset(&ofn,0,sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
// Set lpstrFile[0] to '\0' so that GetOpenFileName does not
// use the contents of szFile to initialize itself.
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0Lua Scripts\0*.LUA\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
// Display the Open dialog box.
fname = GetOpenFileName(&ofn);
#else
FILE *fpipe;