More error-handling

This commit is contained in:
Clownacy 2020-04-23 14:33:59 +01:00
parent 1f9247e587
commit d7c138f818

View file

@ -156,6 +156,9 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
// Create a 'context' (this voodoo magic can be used to undo `GX2SetColorBuffer`,
// allowing us to draw to the screen once again)
gx2_context = (GX2ContextState*)aligned_alloc(GX2_CONTEXT_STATE_ALIGNMENT, sizeof(GX2ContextState));
if (gx2_context != NULL)
{
memset(gx2_context, 0, sizeof(GX2ContextState));
GX2SetupContextStateEx(gx2_context, TRUE);
GX2SetContextState(gx2_context);
@ -190,6 +193,11 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
return framebuffer_surface;
}
else
{
Backend_PrintError("Couldn't allocate memory for the GX2 context");
}
}
else
{
Backend_PrintError("Couldn't create the framebuffer surface");
}