From a67e998c2812c57f222634e313b3904151987a92 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Fri, 16 Sep 2022 17:58:00 -0500 Subject: [PATCH] SDL2 backend is up-to-date. --- joeylib/joeylib.pro | 12 ++++++------ joeylib/src/jSDL2.c | 13 +++---------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/joeylib/joeylib.pro b/joeylib/joeylib.pro index c23cf2f..b860702 100644 --- a/joeylib/joeylib.pro +++ b/joeylib/joeylib.pro @@ -2,7 +2,7 @@ JOEY = /home/scott/joey #CONFIG += SDL12 CONFIG += SDL2 -BREW = /home/linuxbrew/.linuxbrew +#BREW = /home/linuxbrew/.linuxbrew TEMPLATE = app CONFIG += console @@ -19,11 +19,11 @@ defined(BREW,var) { -Wl,-rpath,$$STATICLIB } else { # Use our libraries. - STATICLIB = $$JOEY/sdks/linux/x64/lib - INCLUDEPATH += $$JOEY/sdks/linux/x64/include - LIBS += \ - -L$$STATICLIB \ - -Wl,-rpath,$$STATICLIB + #STATICLIB = $$JOEY/sdks/linux/x64/lib + #INCLUDEPATH += $$JOEY/sdks/linux/x64/include + #LIBS += \ +# -L$$STATICLIB \ +# -Wl,-rpath,$$STATICLIB } INCLUDEPATH += $$PWD/src diff --git a/joeylib/src/jSDL2.c b/joeylib/src/jSDL2.c index 008c12f..52bd27f 100644 --- a/joeylib/src/jSDL2.c +++ b/joeylib/src/jSDL2.c @@ -96,7 +96,6 @@ static jbool _jlModPlaying = jfalse; static jlPlatformModT *_jlModCurrent = NULL; static jbyte _jlModVolume = 255; static jlSoundPlayingT *_jlSoundList = NULL; -static jbyte _jlSoundsPlaying = 0; static jint16 _jlWindowZoom = 2; @@ -250,15 +249,12 @@ static void _jlAudioCallback(void *userdata, Uint8 *buffer, int bytes) { temp = sound; sound = sound->next; jlFree(temp); - _jlSoundsPlaying--; } else { prev = sound; sound = sound->next; } } } - - jlUtilSay(""); } @@ -274,7 +270,6 @@ void jlDisplayPresent(void) { // Render 4 bit copy to proper pixel format. // This extra step preserves palette effects. - SDL_LockTexture(_jlTexture, NULL, &pixelData, &pitch); pixels = (Uint32 *)pixelData; for (int y=0; y<200; y++) { @@ -569,7 +564,6 @@ void jlSoundPlay(jlSoundT *sound, jlSoundChannelE channel, jbyte volume) { sp->len = sp->sound->len; sp->next = _jlSoundList; _jlSoundList = sp; - _jlSoundsPlaying++; SDL_UnlockAudioDevice(_jlAudioDevice); } } @@ -593,7 +587,6 @@ void jlSoundStop(jlSoundT *sound) { temp = cur; cur = cur->next; jlFree(temp); - _jlSoundsPlaying--; } else { prev = cur; cur = cur->next; @@ -716,8 +709,8 @@ void jlUtilTitleSet(char *title) { int main(int argc, char *argv[]) { - int joysticks; - int x; + int joysticks; + int x; (void)argc; (void)argv; @@ -738,7 +731,7 @@ int main(int argc, char *argv[]) { // Create a window and renderer using SDL _jlWindow = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (320 + BORDER_WIDTH * 2) * _jlWindowZoom, (200 + BORDER_WIDTH * 2) * _jlWindowZoom, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); - _jlRenderer = SDL_CreateRenderer(_jlWindow, -1, SDL_RENDERER_SOFTWARE); + _jlRenderer = SDL_CreateRenderer(_jlWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); _jlTexture = SDL_CreateTexture(_jlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200); _jlPixelFormat = SDL_AllocFormat(SDL_GetWindowPixelFormat(_jlWindow));