diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-11-25 20:35:13 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-11-25 20:35:13 +0100 |
commit | 394c9fbb6cc243e46b32aa9e7221b0e6cadd4c13 (patch) | |
tree | 2a6cf365b703be3cdb78045890f84e2a3aa5e74c /emu/emul.c | |
parent | 6c3401b8a2ce7a2dfe21a253f840f286088b1921 (diff) | |
download | 6502-394c9fbb6cc243e46b32aa9e7221b0e6cadd4c13.tar.gz 6502-394c9fbb6cc243e46b32aa9e7221b0e6cadd4c13.tar.bz2 |
some work on emulator, also added gengetopt and cmake support for it
Diffstat (limited to 'emu/emul.c')
-rw-r--r-- | emu/emul.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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 } |