ref: be0c61018bfefcdf4ccbfc9db3148465f4eb9db2
parent: 8524d1e34944348c635173e58d22a88d2ff059b5
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Apr 15 18:01:27 EDT 2020
Update SDL2 backend
--- a/src/Backends/SDL2/Window-Software.cpp
+++ b/src/Backends/SDL2/Window-Software.cpp
@@ -14,7 +14,7 @@
static SDL_Surface *window_sdlsurface;
static SDL_Surface *framebuffer_sdlsurface;
-unsigned char* WindowBackend_Software_CreateWindow(const char *window_title, int screen_width, int screen_height, bool fullscreen, size_t *pitch)
+bool WindowBackend_Software_CreateWindow(const char *window_title, int screen_width, int screen_height, bool fullscreen)
{
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
@@ -33,11 +33,9 @@
if (framebuffer_sdlsurface != NULL)
{
- *pitch = framebuffer_sdlsurface->pitch;
-
Backend_PostWindowCreation();
- return (unsigned char*)framebuffer_sdlsurface->pixels;
+ return true;
}
else
{
@@ -58,7 +56,7 @@
Backend_ShowMessageBox("Fatal error (software rendering backend)", error_message.c_str());
}
- return NULL;
+ return false;
}
void WindowBackend_Software_DestroyWindow(void)
@@ -65,6 +63,13 @@
{
SDL_FreeSurface(framebuffer_sdlsurface);
SDL_DestroyWindow(window);
+}
+
+unsigned char* WindowBackend_Software_GetFramebuffer(size_t *pitch)
+{
+ *pitch = framebuffer_sdlsurface->pitch;
+
+ return (unsigned char*)framebuffer_sdlsurface->pixels;
}
void WindowBackend_Software_Display(void)