MCPcopy Create free account
hub / github.com/DavidColson/Polybox / ShowAssertDialog

Function ShowAssertDialog

source/main.cpp:111–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109// ***********************************************************************
110
111int ShowAssertDialog(String errorMsg) {
112 const SDL_MessageBoxButtonData buttons[] = {
113 { SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 0, "Abort" },
114 { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Debug" },
115 { 0, 2, "Continue" },
116 };
117
118 StringBuilder builder(g_pArenaFrame);
119
120 builder.Append(errorMsg);
121 builder.Append("\n");
122 builder.Append("Trace: \n");
123
124 void* trace[100];
125 u64 frames = Debug::CollectStackTrace(trace, 100, 2);
126 String stackTrace = Debug::PrintStackTraceToString(trace, frames, g_pArenaFrame);
127 builder.Append(stackTrace);
128
129 String message = builder.CreateString(g_pArenaFrame);
130
131 const SDL_MessageBoxData messageboxdata = {
132 SDL_MESSAGEBOX_ERROR,
133 NULL,
134 "Error",
135 message.pData,
136 SDL_arraysize(buttons),
137 buttons,
138 nullptr
139 };
140 i32 buttonid;
141 SDL_ShowMessageBox(&messageboxdata, &buttonid);
142 return buttonid;
143}
144
145// ***********************************************************************
146

Callers 1

AssertHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected