This commit is contained in:
sam-astro 2022-05-24 15:39:34 -04:00
commit 19073fcc7c
2 changed files with 8 additions and 5 deletions

View File

@ -790,6 +790,8 @@ int main(int argc, char* argv[])
#if DEVELOPER_MESSAGES #if DEVELOPER_MESSAGES
cout << scriptPath << endl; cout << scriptPath << endl;
#endif #endif
if (!fileExists(scriptPath)
LogCriticalError("Failed to load script from path: \"" + scriptPath + "\"");
std::string projectDirectory = scriptPath.substr(0, scriptPath.find_last_of("/\\")); std::string projectDirectory = scriptPath.substr(0, scriptPath.find_last_of("/\\"));
#if UNIX #if UNIX
@ -803,13 +805,14 @@ int main(int argc, char* argv[])
#endif #endif
// Change the current working directory to that of the script // Change the current working directory to that of the script
chdir(projectDirectory.c_str()); int chErr = chdir(projectDirectory.c_str());
if(chErr < 0)
LogCriticalError("Failed to change directory to: \"" + projectDirectory.c_str() + "\", error num: " + chErr);
#if DEVELOPER_MESSAGES #if DEVELOPER_MESSAGES
InterpreterLog("Change directory to " + projectDirectory + "..."); InterpreterLog("Changed directory to " + projectDirectory + "...");
#endif #endif
#if DEVELOPER_MESSAGES #if DEVELOPER_MESSAGES
string newPath = filesystem::current_path(); string newPath = filesystem::current_path();
InterpreterLog("Current working directory is " + newPath);
#endif #endif
#elif WINDOWS #elif WINDOWS
// Get script contents as single string // Get script contents as single string
@ -827,7 +830,7 @@ int main(int argc, char* argv[])
LPCWSTR s = wide.c_str(); LPCWSTR s = wide.c_str();
SetCurrentDirectory(s); SetCurrentDirectory(s);
#if DEVELOPER_MESSAGES #if DEVELOPER_MESSAGES
InterpreterLog("Change directory to " + projectDirectory + "..."); InterpreterLog("Changed directory to " + projectDirectory + "...");
#endif #endif
#endif #endif
} }

View File

@ -1032,7 +1032,7 @@ int initGraphics(std::string windowTitle, int width, int height, int pixelScale)
gWindow = SDL_CreateWindow(windowTitle.c_str(), 40, 40, WINDOW_WIDTH * PIXEL_SCALE, WINDOW_HEIGHT * PIXEL_SCALE, SDL_WINDOW_SHOWN | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); gWindow = SDL_CreateWindow(windowTitle.c_str(), 40, 40, WINDOW_WIDTH * PIXEL_SCALE, WINDOW_HEIGHT * PIXEL_SCALE, SDL_WINDOW_SHOWN | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
gRenderer = SDL_CreateRenderer(gWindow, -1, 0); gRenderer = SDL_CreateRenderer(gWindow, -1, 0);
SDL_RenderSetLogicalSize(gRenderer, 256 * PIXEL_SCALE, 224 * PIXEL_SCALE); SDL_RenderSetLogicalSize(gRenderer, WINDOW_WIDTH * PIXEL_SCALE, WINDOW_HEIGHT * PIXEL_SCALE);
SDL_RenderSetScale(gRenderer, PIXEL_SCALE, PIXEL_SCALE); SDL_RenderSetScale(gRenderer, PIXEL_SCALE, PIXEL_SCALE);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, 0); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, 0);