Changeset d9b6a1c in opengl-game for new-game.cpp
- Timestamp:
- May 24, 2019, 5:37:05 PM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 98f06d9
- Parents:
- caa2359
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
new-game.cpp
rcaa2359 rd9b6a1c 32 32 #include "logger.h" 33 33 #include "utils.h" 34 35 #include "Compiler.h" 36 37 #ifdef WINDOWS 38 #include <windows.h> 39 #include <excpt.h> 40 #include <io.h> 41 42 #include "FileStackWalker.h" 43 #else 44 // TODO: Move as much Windows crash-logging stuff into CrashLogger as well 45 #include "CrashLogger.h" 46 #endif 34 47 35 48 using namespace std; … … 212 225 void calculateObjectBoundingBox(SceneObject* obj); 213 226 214 void initializeParticleEffectBuffers(map<GLuint, BufferInfo>& shaderBufferInfo,215 map<ObjectType, ShaderModelGroup>& modelGroups,216 GLuint ubo);217 218 227 void populateBuffers(vector<SceneObject*>& objects, 219 228 map<GLuint, BufferInfo>& shaderBufferInfo, … … 297 306 */ 298 307 308 CrashLogger logger; 309 310 // Helps to test logging during crashes 311 /* 312 void badFunc() { 313 int* test = NULL; 314 *test = 1; 315 } 316 */ 317 318 #ifdef WINDOWS 319 320 // Give it a file handle to crash.log instead (using the code in CrashLogger.cpp) 321 FileStackWalker sw(2); 322 323 bool handleException(unsigned int expCode, EXCEPTION_POINTERS* pExp, HANDLE thread); 324 #endif 325 299 326 int main(int argc, char* argv[]) { 327 #ifdef WINDOWS 328 __try { 329 __main(argc, argv); 330 // maybe do this and call a function inside CrashLogger 331 // In that case, also pass GetCurrentThread() as a parameter to then pass to handleException 332 // I could also move almost all of this into CrashLogger by creating a function in CrashLogger that takes a reference 333 // to the effective main function and, for Windows, wraps it in all this error-handling stuff 334 } __except( handleException(GetExceptionCode(), GetExceptionInformation(), GetCurrentThread()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_EXECUTE_HANDLER) { 335 _write(2, "CAUGHT\n", 7); 336 } 337 338 exit(0); 339 } 340 341 int __main(int argc, char* argv[]) { 342 #endif 300 343 cout << "New OpenGL Game" << endl; 301 344 … … 309 352 } 310 353 311 #ifdef __APPLE__354 #ifdef MAC 312 355 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 313 356 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); … … 973 1016 delete *it; 974 1017 } 975 976 return 0; 977 } 1018 } 1019 1020 #ifdef WINDOWS 1021 bool handleException(unsigned int expCode, EXCEPTION_POINTERS* pExp, HANDLE thread) { 1022 if (pExp != NULL) { 1023 sw.ShowCallstack(thread, pExp->ContextRecord); 1024 } 1025 1026 if (expCode == EXCEPTION_ACCESS_VIOLATION) { 1027 _write(2, "ACCESS VIOLATION\n", 17); 1028 } 1029 1030 return true; 1031 } 1032 #endif 978 1033 979 1034 void glfw_error_callback(int error, const char* description) {
Note:
See TracChangeset
for help on using the changeset viewer.