From 394c9fbb6cc243e46b32aa9e7221b0e6cadd4c13 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 25 Nov 2020 20:35:13 +0100 Subject: some work on emulator, also added gengetopt and cmake support for it --- emu/emul.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'emu/emul.c') 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 } -- cgit v1.2.3-54-g00ecf