Ports: Remove SDL Timer replacement in MilkyTracker

This commit is contained in:
jakewestrip 2021-04-28 21:19:03 +10:00 committed by Linus Groh
parent 1ce70bb418
commit 81eab1a9d1
2 changed files with 1 additions and 66 deletions

View file

@ -1,65 +0,0 @@
--- MilkyTracker-1.03.00/src/tracker/sdl/SDL_Main.cpp 2021-04-27 15:17:42.529000000 +1000
+++ MilkyTracker-1.03.00/src/tracker/sdl/SDL_Main.cpp 2021-04-27 15:17:42.529000000 +1000
@@ -68,6 +68,8 @@
#include <SDL.h>
#include "SDL_KeyTranslation.h"
+
+#include <LibCore/Timer.h>
// ---------------------------- Tracker includes ----------------------------
#include "PPUI.h"
#include "DisplayDevice_SDL.h"
@@ -83,7 +85,7 @@
#endif
// --------------------------------------------------------------------------
-static SDL_TimerID timer;
+RefPtr<Core::Timer> m_timer;
// Tracker globals
static PPScreen* myTrackerScreen = NULL;
@@ -163,11 +165,11 @@
SDLUserEventMidiKeyUp,
};
-static Uint32 SDLCALL timerCallback(Uint32 interval, void* param)
+static void timerCallback()
{
if (!myTrackerScreen || !myTracker || !ticking)
{
- return interval;
+ return;
}
SDL_UserEvent ev;
@@ -219,8 +221,6 @@
//PPEvent myEvent(eRMouseRepeat, &p, sizeof(PPPoint));
//RaiseEventSerialized(&myEvent);
}
-
- return interval;
}
#ifdef HAVE_LIBRTMIDI
@@ -834,7 +834,12 @@
#endif
// Try to create timer
- timer = SDL_AddTimer(20, timerCallback, NULL);
+ m_timer = Core::Timer::construct();
+ m_timer->on_timeout = [&]() {
+ timerCallback();
+ };
+ m_timer->set_interval(20);
+ m_timer->start();
// Start capturing text input events
SDL_StartTextInput();
@@ -1033,7 +1038,6 @@
}
ticking = false;
- SDL_RemoveTimer(timer);
globalMutex->lock();
#ifdef HAVE_LIBRTMIDI

View file

@ -4,7 +4,7 @@
set(INSTALL_DEST ${CMAKE_INSTALL_BINDIR})
endif()
+target_link_libraries(tracker -lSDL2 -lgui -lipc -lm -lcore)
+target_link_libraries(tracker -lSDL2 -lgui -lipc -lm)
+set(INSTALL_DEST bin)
+
install(TARGETS tracker DESTINATION ${INSTALL_DEST})