Update SDL2 backend
This commit is contained in:
parent
8524d1e349
commit
be0c61018b
1 changed files with 10 additions and 5 deletions
|
@ -14,7 +14,7 @@ SDL_Window *window;
|
||||||
static SDL_Surface *window_sdlsurface;
|
static SDL_Surface *window_sdlsurface;
|
||||||
static SDL_Surface *framebuffer_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);
|
window = SDL_CreateWindow(window_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screen_width, screen_height, 0);
|
||||||
|
|
||||||
|
@ -33,11 +33,9 @@ unsigned char* WindowBackend_Software_CreateWindow(const char *window_title, int
|
||||||
|
|
||||||
if (framebuffer_sdlsurface != NULL)
|
if (framebuffer_sdlsurface != NULL)
|
||||||
{
|
{
|
||||||
*pitch = framebuffer_sdlsurface->pitch;
|
|
||||||
|
|
||||||
Backend_PostWindowCreation();
|
Backend_PostWindowCreation();
|
||||||
|
|
||||||
return (unsigned char*)framebuffer_sdlsurface->pixels;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -58,7 +56,7 @@ unsigned char* WindowBackend_Software_CreateWindow(const char *window_title, int
|
||||||
Backend_ShowMessageBox("Fatal error (software rendering backend)", error_message.c_str());
|
Backend_ShowMessageBox("Fatal error (software rendering backend)", error_message.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowBackend_Software_DestroyWindow(void)
|
void WindowBackend_Software_DestroyWindow(void)
|
||||||
|
@ -67,6 +65,13 @@ void WindowBackend_Software_DestroyWindow(void)
|
||||||
SDL_DestroyWindow(window);
|
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)
|
void WindowBackend_Software_Display(void)
|
||||||
{
|
{
|
||||||
if (SDL_BlitSurface(framebuffer_sdlsurface, NULL, window_sdlsurface, NULL) < 0)
|
if (SDL_BlitSurface(framebuffer_sdlsurface, NULL, window_sdlsurface, NULL) < 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue