#include "pch.h" #include "Core.h" #include #include void StartHeapControl(); void DumpMemoryLeaks(); int main( int argc, char *argv[] ) { srand(int(time(nullptr))); { // Make sure stack objects go out of scope before memory leaks are dumped StartHeapControl(); try { Core core{ Window{ "Spelunky - Yomtov, Nir - 1DAE09", 1280.0f, 720.0f } }; core.Run(); } catch (std::runtime_error &e) { std::cerr << "Exception occured!\n" << e.what() << '\n'; std::cin.get(); } } //DumpMemoryLeaks(); return 0; } void StartHeapControl() { #if defined(DEBUG) | defined(_DEBUG) // Notify user if heap is corrupt HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); // Report detected leaks when the program exits _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); // Set a breakpoint on the specified object allocation order number //_CrtSetBreakAlloc( 156 ); #endif } void DumpMemoryLeaks() { #if defined(DEBUG) | defined(_DEBUG) _CrtDumpMemoryLeaks(); #endif }