Make it so Backend_Init
can fail
This commit is contained in:
parent
7d65d009ff
commit
41d5c5b5c8
4 changed files with 25 additions and 13 deletions
|
@ -150,9 +150,12 @@ static void DragAndDropCallback(GLFWwindow *window, int count, const char **path
|
|||
LoadProfile(paths[0]);
|
||||
}
|
||||
|
||||
void Backend_Init(void)
|
||||
BOOL Backend_Init(void)
|
||||
{
|
||||
glfwInit();
|
||||
if (glfwInit() == GL_TRUE)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Backend_Deinit(void)
|
||||
|
|
|
@ -85,7 +85,7 @@ enum
|
|||
|
||||
extern BOOL bActive;
|
||||
|
||||
void Backend_Init(void);
|
||||
BOOL Backend_Init(void);
|
||||
void Backend_Deinit(void);
|
||||
void Backend_PostWindowCreation(void);
|
||||
BOOL Backend_GetBasePath(char *string_buffer);
|
||||
|
|
|
@ -30,21 +30,29 @@ static unsigned char *cursor_surface_pixels;
|
|||
static SDL_Surface *cursor_surface;
|
||||
static SDL_Cursor *cursor;
|
||||
|
||||
void Backend_Init(void)
|
||||
BOOL Backend_Init(void)
|
||||
{
|
||||
SDL_Init(SDL_INIT_EVENTS);
|
||||
if (SDL_Init(SDL_INIT_EVENTS) == 0)
|
||||
{
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0)
|
||||
{
|
||||
puts("Available SDL2 video drivers:");
|
||||
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
for (int i = 0; i < SDL_GetNumVideoDrivers(); ++i)
|
||||
puts(SDL_GetVideoDriver(i));
|
||||
|
||||
puts("Available SDL2 video drivers:");
|
||||
const char *driver = SDL_GetCurrentVideoDriver();
|
||||
|
||||
for (int i = 0; i < SDL_GetNumVideoDrivers(); ++i)
|
||||
puts(SDL_GetVideoDriver(i));
|
||||
if (driver != NULL)
|
||||
printf("Selected SDL2 video driver: %s\n", driver);
|
||||
|
||||
const char *driver = SDL_GetCurrentVideoDriver();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (driver != NULL)
|
||||
printf("Selected SDL2 video driver: %s\n", driver);
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Backend_Deinit(void)
|
||||
|
|
|
@ -88,7 +88,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
int i;
|
||||
|
||||
Backend_Init();
|
||||
if (!Backend_Init())
|
||||
return EXIT_FAILURE;
|
||||
|
||||
// Get executable's path
|
||||
if (!Backend_GetBasePath(gModulePath))
|
||||
|
|
Loading…
Add table
Reference in a new issue