diff --git a/src/.gitignore b/src/.gitignore index e884d39..4e70fbc 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -32,4 +32,6 @@ *.app # build dirs -cmake-build/ \ No newline at end of file +cmake-build/ +out/ +.vs/ \ No newline at end of file diff --git a/src/engine/main.cpp b/src/engine/main.cpp index 01770da..96b99f3 100644 --- a/src/engine/main.cpp +++ b/src/engine/main.cpp @@ -7,7 +7,7 @@ #include #include -//#define VISUAL_STUDIO +#define VISUAL_STUDIO typedef void (*Startup)(void*); typedef void (*Update)(); @@ -16,7 +16,7 @@ typedef void (*Shutdown)(); constexpr UINT WM_CUSTOM_DLL_CHANGE = WM_USER + 1; #ifdef VISUAL_STUDIO - const char* DLLPath = "Debug/PuzGame.dll"; + const char* DLLPath = "PuzGame2.dll"; #else const char* DLLPath = "libPuzGame.dll"; #endif @@ -166,7 +166,7 @@ bool ReloadDLL() } #ifdef VISUAL_STUDIO - Shutdown ShutdownReloaded = (Shutdown)GetProcAddress(DevData.GameLib, "_ZN4Game8ShutdownEv"); + Shutdown ShutdownReloaded = (Shutdown)GetProcAddress(DevData.GameLib, "?Shutdown@Game@@YAXXZ"); #else Shutdown ShutdownReloaded = (Shutdown)GetProcAddress(DevData.GameLib, "_ZN4Game8ShutdownEv"); #endif @@ -189,6 +189,11 @@ int main() HWND window = InitWindow(); if (window == NULL) return 1; + char PathBuf[512]{ 0 }; + GetCurrentDirectory(sizeof(PathBuf), PathBuf); + + printf("Current path: %s", PathBuf); + if (!ReloadDLL()) return 1; DWORD fileWatcherThreadId = 0; diff --git a/src/game/Log.cpp b/src/game/Log.cpp index c128084..8a8319e 100644 --- a/src/game/Log.cpp +++ b/src/game/Log.cpp @@ -9,6 +9,8 @@ namespace void Log(const char *format, ...) { va_list args; + va_start(args, format); bx::snprintf(LineBuffer, sizeof(LineBuffer), "%s\n", format); - bx::printf(LineBuffer, args); + bx::vprintf(LineBuffer, args); + va_end(args); } diff --git a/src/game/rendering/Rendering.cpp b/src/game/rendering/Rendering.cpp index 8e201f8..4b355ff 100644 --- a/src/game/rendering/Rendering.cpp +++ b/src/game/rendering/Rendering.cpp @@ -83,7 +83,9 @@ namespace Game filePath.join(fileName); bx::FileReader fileReader; - bgfx::ShaderHandle result = bgfx::createShader(loadMem(&fileReader, filePath.getCPtr())); + const bgfx::Memory* mem = loadMem(&fileReader, filePath.getCPtr()); + if (mem == nullptr) return {}; + bgfx::ShaderHandle result = bgfx::createShader(mem); return result; } } @@ -97,8 +99,8 @@ namespace Game init.platformData.nwh = (void*)window; init.platformData.ndt = nullptr; init.platformData.type = bgfx::NativeWindowHandleType::Default; - init.resolution.width = 1920; - init.resolution.height = 1080; + init.resolution.width = State.WindowWidth; + init.resolution.height = State.WindowHeight; init.resolution.reset = BGFX_RESET_VSYNC; if (!bgfx::init(init)) { @@ -173,7 +175,6 @@ namespace Game bgfx::setIndexBuffer(IndexBuffer); bgfx::setState(state); - // Submit primitive for rendering to view 0. bgfx::submit(0, Shader); } bgfx::dbgTextPrintf(1, 1, 0x0F, "Time: %f", time);