replaced sdl_timer with a qtimer, resulting in a binary which does not link sdl

This commit is contained in:
Joakim L. Gilje
2021-12-06 21:33:25 +01:00
parent b16702bc81
commit db0c90a835
4 changed files with 5 additions and 17 deletions

View File

@@ -11,11 +11,7 @@
#include <thread>
#include "SDL.h"
#include "SDL_mutex.h"
#include "SDL_timer.h"
#include "qt_mainwindow.hpp"
#include "qt_sdl.h"
#include "cocoa_mouse.hpp"
@@ -77,12 +73,6 @@ main_thread_fn()
is_quit = 1;
}
uint32_t timer_onesec(uint32_t interval, void* param)
{
pc_onesec();
return interval;
}
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
#ifdef __APPLE__
@@ -90,7 +80,6 @@ int main(int argc, char* argv[]) {
app.installNativeEventFilter(&cocoafilter);
#endif
elapsed_timer.start();
SDL_Init(SDL_INIT_TIMER);
pc_init(argc, argv);
if (! pc_init_modules()) {
@@ -113,7 +102,11 @@ int main(int argc, char* argv[]) {
/* Set the PAUSE mode depending on the renderer. */
// plat_pause(0);
SDL_AddTimer(1000, timer_onesec, nullptr);
QTimer onesec;
QObject::connect(&onesec, &QTimer::timeout, &app, [] {
pc_onesec();
});
onesec.start(1000);
/* Initialize the rendering window, or fullscreen. */
QTimer::singleShot(50, []() { plat_resize(640, 480); } );