1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 23:29:16 +00:00

Separate window and renderer creation; use software rendering

It seems _slightly_ faster than hardware acceleration for the uses we
have.
This commit is contained in:
Peter Evans 2018-04-02 08:37:01 -05:00
parent 2d0952133a
commit c178e417b7

View File

@ -110,13 +110,23 @@ vm_screen_add_window(vm_screen *screen, int width, int height)
// If HEADLESS is defined, we will assume we _don't_ want an actual // If HEADLESS is defined, we will assume we _don't_ want an actual
// drawing surface, but want to pretend we've added one. // drawing surface, but want to pretend we've added one.
#ifndef HEADLESS #ifndef HEADLESS
SDL_CreateWindowAndRenderer( screen->window = SDL_CreateWindow("erc",
width, height, 0, &screen->window, &screen->render); SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
width, height, 0);
if (screen->window == NULL || screen->render == NULL) { if (screen->window == NULL) {
log_crit("Could not create window: %s", SDL_GetError()); log_crit("Could not create window: %s", SDL_GetError());
return ERR_GFXINIT; return ERR_GFXINIT;
} }
screen->render = SDL_CreateRenderer(screen->window, -1,
SDL_RENDERER_SOFTWARE);
if (screen->render == NULL) {
log_crit("Could not create renderer: %s", SDL_GetError());
return ERR_GFXINIT;
}
#endif #endif
// We plan to draw onto a surface that is xcoords x ycoords in area, // We plan to draw onto a surface that is xcoords x ycoords in area,
@ -195,7 +205,7 @@ vm_screen_active(vm_screen *scr)
void void
vm_screen_prepare(vm_screen *scr) vm_screen_prepare(vm_screen *scr)
{ {
SDL_RenderClear(scr->render); //SDL_RenderClear(scr->render);
} }
/* /*