Revert "Backends: Added init/de-init messages for backends"
This reverts commit 9be8b9a493
.
This commit is contained in:
parent
063ec2a92a
commit
4f7cc9582d
10 changed files with 1 additions and 66 deletions
|
@ -65,7 +65,6 @@ static void Callback(void *user_data, Uint8 *stream_uint8, int len)
|
||||||
|
|
||||||
BOOL AudioBackend_Init(void)
|
BOOL AudioBackend_Init(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing SDL2 audio backend...");
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
std::string errorMessage = std::string("'SDL_InitSubSystem(SDL_INIT_AUDIO)' failed: ") + SDL_GetError();
|
std::string errorMessage = std::string("'SDL_InitSubSystem(SDL_INIT_AUDIO)' failed: ") + SDL_GetError();
|
||||||
|
@ -102,17 +101,14 @@ BOOL AudioBackend_Init(void)
|
||||||
|
|
||||||
Backend_PrintInfo("Selected SDL audio driver: %s", SDL_GetCurrentAudioDriver());
|
Backend_PrintInfo("Selected SDL audio driver: %s", SDL_GetCurrentAudioDriver());
|
||||||
|
|
||||||
Backend_PrintInfo("Succesfully initialized SDL2 audio backend");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioBackend_Deinit(void)
|
void AudioBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing SDL2 audio backend...");
|
|
||||||
SDL_CloseAudioDevice(device_id);
|
SDL_CloseAudioDevice(device_id);
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||||
Backend_PrintInfo("Finished de-initializing SDL2 audio backend");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBackend_Sound* AudioBackend_CreateSound(unsigned int frequency, const unsigned char *samples, size_t length)
|
AudioBackend_Sound* AudioBackend_CreateSound(unsigned int frequency, const unsigned char *samples, size_t length)
|
||||||
|
|
|
@ -73,7 +73,6 @@ static void Callback(ma_device *device, void *output_stream, const void *input_s
|
||||||
|
|
||||||
BOOL AudioBackend_Init(void)
|
BOOL AudioBackend_Init(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing miniaudio audio backend...");
|
|
||||||
ma_device_config config = ma_device_config_init(ma_device_type_playback);
|
ma_device_config config = ma_device_config_init(ma_device_type_playback);
|
||||||
config.playback.pDeviceID = NULL;
|
config.playback.pDeviceID = NULL;
|
||||||
config.playback.format = ma_format_f32;
|
config.playback.format = ma_format_f32;
|
||||||
|
@ -100,7 +99,6 @@ BOOL AudioBackend_Init(void)
|
||||||
|
|
||||||
Mixer_Init(device.sampleRate);
|
Mixer_Init(device.sampleRate);
|
||||||
|
|
||||||
Backend_PrintInfo("Successfully initialized miniaudio audio backend");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -135,7 +133,6 @@ BOOL AudioBackend_Init(void)
|
||||||
|
|
||||||
void AudioBackend_Deinit(void)
|
void AudioBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing miniaudio audio backend...");
|
|
||||||
ma_result return_value;
|
ma_result return_value;
|
||||||
return_value = ma_device_stop(&device);
|
return_value = ma_device_stop(&device);
|
||||||
|
|
||||||
|
@ -147,7 +144,6 @@ void AudioBackend_Deinit(void)
|
||||||
ma_mutex_uninit(&mutex);
|
ma_mutex_uninit(&mutex);
|
||||||
|
|
||||||
ma_device_uninit(&device);
|
ma_device_uninit(&device);
|
||||||
Backend_PrintInfo("Finished de-initializing miniaudio audio backend...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBackend_Sound* AudioBackend_CreateSound(unsigned int frequency, const unsigned char *samples, size_t length)
|
AudioBackend_Sound* AudioBackend_CreateSound(unsigned int frequency, const unsigned char *samples, size_t length)
|
||||||
|
|
|
@ -71,7 +71,6 @@ static void JoystickCallback(int joystick_id, int event)
|
||||||
|
|
||||||
BOOL ControllerBackend_Init(void)
|
BOOL ControllerBackend_Init(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing GLFW controller backend...");
|
|
||||||
// Connect joysticks that are already plugged-in
|
// Connect joysticks that are already plugged-in
|
||||||
for (int i = GLFW_JOYSTICK_1; i < GLFW_JOYSTICK_LAST; ++i)
|
for (int i = GLFW_JOYSTICK_1; i < GLFW_JOYSTICK_LAST; ++i)
|
||||||
if (glfwJoystickPresent(i) == GLFW_TRUE)
|
if (glfwJoystickPresent(i) == GLFW_TRUE)
|
||||||
|
@ -80,13 +79,11 @@ BOOL ControllerBackend_Init(void)
|
||||||
// Set-up the callback for future (dis)connections
|
// Set-up the callback for future (dis)connections
|
||||||
glfwSetJoystickCallback(JoystickCallback);
|
glfwSetJoystickCallback(JoystickCallback);
|
||||||
|
|
||||||
Backend_PrintInfo("Sucessfully initialized GLFW controller backend");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBackend_Deinit(void)
|
void ControllerBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing GLFW controller backend...");
|
|
||||||
glfwSetJoystickCallback(NULL);
|
glfwSetJoystickCallback(NULL);
|
||||||
|
|
||||||
joystick_connected = FALSE;
|
joystick_connected = FALSE;
|
||||||
|
@ -94,7 +91,6 @@ void ControllerBackend_Deinit(void)
|
||||||
|
|
||||||
free(axis_neutrals);
|
free(axis_neutrals);
|
||||||
axis_neutrals = NULL;
|
axis_neutrals = NULL;
|
||||||
Backend_PrintInfo("Finished de-initializing GLFW controller backend");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
||||||
|
|
|
@ -159,14 +159,10 @@ static void ErrorCallback(int code, const char *description)
|
||||||
|
|
||||||
BOOL Backend_Init(void)
|
BOOL Backend_Init(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing GLFW platform backend...");
|
|
||||||
glfwSetErrorCallback(ErrorCallback);
|
glfwSetErrorCallback(ErrorCallback);
|
||||||
|
|
||||||
if (glfwInit() == GL_TRUE)
|
if (glfwInit() == GL_TRUE)
|
||||||
{
|
|
||||||
Backend_PrintInfo("Successfully initialized GLFW platform backend");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
Backend_ShowMessageBox("Fatal error", "Could not initialise GLFW3");
|
Backend_ShowMessageBox("Fatal error", "Could not initialise GLFW3");
|
||||||
|
|
||||||
|
@ -175,12 +171,10 @@ BOOL Backend_Init(void)
|
||||||
|
|
||||||
void Backend_Deinit(void)
|
void Backend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing GLFW platform backend...");
|
|
||||||
if (cursor != NULL)
|
if (cursor != NULL)
|
||||||
glfwDestroyCursor(cursor);
|
glfwDestroyCursor(cursor);
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
Backend_PrintInfo("Finished de-initializing GLFW platform backend ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Backend_PostWindowCreation(void)
|
void Backend_PostWindowCreation(void)
|
||||||
|
|
|
@ -583,10 +583,7 @@ static void PostGLCallCallback(const char *name, void *function_pointer, int len
|
||||||
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
#ifndef USE_OPENGLES2
|
#ifndef USE_OPENGLES2
|
||||||
Backend_PrintInfo("Initializing OpenGL3 rendering backend...");
|
|
||||||
glad_set_post_callback(PostGLCallCallback);
|
glad_set_post_callback(PostGLCallCallback);
|
||||||
#else
|
|
||||||
Backend_PrintInfo("Initializing OpenGLES2 rendering backend...");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
actual_screen_width = screen_width;
|
actual_screen_width = screen_width;
|
||||||
|
@ -671,12 +668,6 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
|
||||||
config.delete_texture_callback = GlyphBatch_DestroyTexture;
|
config.delete_texture_callback = GlyphBatch_DestroyTexture;
|
||||||
spritebatch_init(&glyph_batcher, &config, NULL);
|
spritebatch_init(&glyph_batcher, &config, NULL);
|
||||||
|
|
||||||
#ifndef USE_OPENGLES2
|
|
||||||
Backend_PrintInfo("Successfully initialized OpenGL3 rendering backend");
|
|
||||||
#else
|
|
||||||
Backend_PrintInfo("Successfully initialized OpenGLES2 rendering backend");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return &framebuffer;
|
return &framebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,11 +694,6 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
|
||||||
|
|
||||||
void RenderBackend_Deinit(void)
|
void RenderBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
#ifndef USE_OPENGLES2
|
|
||||||
Backend_PrintInfo("De-initializing OpenGL3 rendering backend...");
|
|
||||||
#else
|
|
||||||
Backend_PrintInfo("De-initializing OpenGLES2 rendering backend...");
|
|
||||||
#endif
|
|
||||||
free(local_vertex_buffer);
|
free(local_vertex_buffer);
|
||||||
|
|
||||||
spritebatch_term(&glyph_batcher);
|
spritebatch_term(&glyph_batcher);
|
||||||
|
@ -724,12 +710,6 @@ void RenderBackend_Deinit(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WindowBackend_OpenGL_DestroyWindow();
|
WindowBackend_OpenGL_DestroyWindow();
|
||||||
|
|
||||||
#ifndef USE_OPENGLES2
|
|
||||||
Backend_PrintInfo("Finished de-initializing OpenGL3 rendering backend");
|
|
||||||
#else
|
|
||||||
Backend_PrintInfo("Finished de-initializing OpenGLES2 rendering backend");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_DrawScreen(void)
|
void RenderBackend_DrawScreen(void)
|
||||||
|
|
|
@ -47,7 +47,6 @@ static void RectToSDLRect(const RECT *rect, SDL_Rect *sdl_rect)
|
||||||
|
|
||||||
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing SDLSurface rendering backend...");
|
|
||||||
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
|
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
|
||||||
|
|
||||||
if (window != NULL)
|
if (window != NULL)
|
||||||
|
@ -67,7 +66,6 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
|
||||||
{
|
{
|
||||||
Backend_PostWindowCreation();
|
Backend_PostWindowCreation();
|
||||||
|
|
||||||
Backend_PrintInfo("Successfully initialized SDLSurface rendering backend");
|
|
||||||
return &framebuffer;
|
return &framebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +91,8 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
|
||||||
|
|
||||||
void RenderBackend_Deinit(void)
|
void RenderBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing SDLSurface rendering backend...");
|
|
||||||
SDL_FreeSurface(framebuffer.sdlsurface);
|
SDL_FreeSurface(framebuffer.sdlsurface);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
Backend_PrintInfo("Finished de-initializing SDLSurface rendering backend");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_DrawScreen(void)
|
void RenderBackend_DrawScreen(void)
|
||||||
|
|
|
@ -128,7 +128,6 @@ static void GlyphBatch_DestroyTexture(SPRITEBATCH_U64 texture_id, void *udata)
|
||||||
|
|
||||||
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing SDLTexture rendering backend...");
|
|
||||||
Backend_PrintInfo("Available SDL render drivers:");
|
Backend_PrintInfo("Available SDL render drivers:");
|
||||||
|
|
||||||
for (int i = 0; i < SDL_GetNumRenderDrivers(); ++i)
|
for (int i = 0; i < SDL_GetNumRenderDrivers(); ++i)
|
||||||
|
@ -186,7 +185,6 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
|
||||||
{
|
{
|
||||||
Backend_PostWindowCreation();
|
Backend_PostWindowCreation();
|
||||||
|
|
||||||
Backend_PrintInfo("Successfully initialized SDLTexture rendering backend");
|
|
||||||
return &framebuffer;
|
return &framebuffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -222,12 +220,10 @@ RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_w
|
||||||
|
|
||||||
void RenderBackend_Deinit(void)
|
void RenderBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing SDLTexture rendering backend...");
|
|
||||||
spritebatch_term(&glyph_batcher);
|
spritebatch_term(&glyph_batcher);
|
||||||
SDL_DestroyTexture(framebuffer.texture);
|
SDL_DestroyTexture(framebuffer.texture);
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_DestroyRenderer(renderer);
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
Backend_PrintInfo("Finished de-initializing SDLTexture rendering backend...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_DrawScreen(void)
|
void RenderBackend_DrawScreen(void)
|
||||||
|
|
|
@ -35,29 +35,18 @@ static RenderBackend_Surface *glyph_destination_surface;
|
||||||
|
|
||||||
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
RenderBackend_Surface* RenderBackend_Init(const char *window_title, int screen_width, int screen_height, BOOL fullscreen)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing Software rendering backend...");
|
|
||||||
size_t pitch;
|
size_t pitch;
|
||||||
framebuffer.pixels = WindowBackend_Software_CreateWindow(window_title, screen_width, screen_height, fullscreen, &pitch);
|
framebuffer.pixels = WindowBackend_Software_CreateWindow(window_title, screen_width, screen_height, fullscreen, &pitch);
|
||||||
framebuffer.width = screen_width;
|
framebuffer.width = screen_width;
|
||||||
framebuffer.height = screen_height;
|
framebuffer.height = screen_height;
|
||||||
framebuffer.pitch = pitch;
|
framebuffer.pitch = pitch;
|
||||||
|
|
||||||
if (framebuffer.pixels)
|
return &framebuffer;
|
||||||
{
|
|
||||||
Backend_PrintInfo("Successfully initialized Software rendering backend");
|
|
||||||
return &framebuffer;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Backend_PrintError("Failed to create window");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_Deinit(void)
|
void RenderBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing Software rendering backend...");
|
|
||||||
WindowBackend_Software_DestroyWindow();
|
WindowBackend_Software_DestroyWindow();
|
||||||
Backend_PrintInfo("Finished de-initializing Software rendering backend");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderBackend_DrawScreen(void)
|
void RenderBackend_DrawScreen(void)
|
||||||
|
|
|
@ -17,20 +17,17 @@ static Sint16 *axis_neutrals;
|
||||||
|
|
||||||
BOOL ControllerBackend_Init(void)
|
BOOL ControllerBackend_Init(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing SDL2 controller backend...");
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
|
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
|
||||||
{
|
{
|
||||||
Backend_PrintError("Couldn't initialise joystick SDL subsystem: %s", SDL_GetError());
|
Backend_PrintError("Couldn't initialise joystick SDL subsystem: %s", SDL_GetError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Backend_PrintInfo("Successfully initialized SDL2 controller backend");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerBackend_Deinit(void)
|
void ControllerBackend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing SDL2 controller backend...");
|
|
||||||
if (joystick != NULL)
|
if (joystick != NULL)
|
||||||
{
|
{
|
||||||
SDL_JoystickClose(joystick);
|
SDL_JoystickClose(joystick);
|
||||||
|
@ -38,7 +35,6 @@ void ControllerBackend_Deinit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||||
Backend_PrintInfo("Finished de-initializing SDL2 controller backend");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
BOOL ControllerBackend_GetJoystickStatus(JOYSTICK_STATUS *status)
|
||||||
|
|
|
@ -33,7 +33,6 @@ static SDL_Cursor *cursor;
|
||||||
|
|
||||||
BOOL Backend_Init(void)
|
BOOL Backend_Init(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("Initializing SDL2 platform backend...");
|
|
||||||
if (SDL_Init(SDL_INIT_EVENTS) == 0)
|
if (SDL_Init(SDL_INIT_EVENTS) == 0)
|
||||||
{
|
{
|
||||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0)
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0)
|
||||||
|
@ -50,7 +49,6 @@ BOOL Backend_Init(void)
|
||||||
else
|
else
|
||||||
Backend_PrintError("No SDL video driver initialized !");
|
Backend_PrintError("No SDL video driver initialized !");
|
||||||
|
|
||||||
Backend_PrintInfo("Successfully initialized SDL2 platform backend");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +67,6 @@ BOOL Backend_Init(void)
|
||||||
|
|
||||||
void Backend_Deinit(void)
|
void Backend_Deinit(void)
|
||||||
{
|
{
|
||||||
Backend_PrintInfo("De-initializing SDL2 platform backend...");
|
|
||||||
if (cursor != NULL)
|
if (cursor != NULL)
|
||||||
SDL_FreeCursor(cursor);
|
SDL_FreeCursor(cursor);
|
||||||
|
|
||||||
|
@ -79,7 +76,6 @@ void Backend_Deinit(void)
|
||||||
free(cursor_surface_pixels);
|
free(cursor_surface_pixels);
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
Backend_PrintInfo("Finished de-initializing SDL2 platform backend...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Backend_PostWindowCreation(void)
|
void Backend_PostWindowCreation(void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue