summaryrefslogtreecommitdiff
path: root/emu/emul.c
diff options
context:
space:
mode:
Diffstat (limited to 'emu/emul.c')
-rw-r--r--emu/emul.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/emu/emul.c b/emu/emul.c
index dc7453b..70a1144 100644
--- a/emu/emul.c
+++ b/emu/emul.c
@@ -23,14 +23,12 @@ void emul_start( emul_t *emul )
SDL_ShowCursor( SDL_ENABLE );
int display = -1;
- SDL_Rect display_rect;
for( int i = 0; i < SDL_GetNumVideoDisplays( ); i++ ) {
SDL_Rect rect;
if( SDL_GetDisplayBounds( i, &rect ) == 0 ) {
fprintf( stderr, "INFO: display %d has dimensions %dx%d\n",
i, rect.w, rect.h );
display = i;
- display_rect = rect;
} else {
fprintf( stderr, "ERROR: SDL_GetDisplayBounds failed: %s\n", SDL_GetError( ) );
exit( EXIT_FAILURE );
@@ -110,8 +108,12 @@ void emul_run( emul_t *emul )
void emul_free( emul_t *emul )
{
- SDL_DestroyTexture( emul->background_texture );
- SDL_FreeSurface( emul->background_image );
- SDL_DestroyRenderer( emul->renderer );
- SDL_DestroyWindow( emul->window );
+#ifdef WITH_GUI
+ if( emul->gui ) {
+ SDL_DestroyTexture( emul->background_texture );
+ SDL_FreeSurface( emul->background_image );
+ SDL_DestroyRenderer( emul->renderer );
+ SDL_DestroyWindow( emul->window );
+ }
+#endif
}