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

@@ -10,7 +10,6 @@ add_library(plat STATIC qt.c qt_main.cpp qt_platform.cpp cpp11_thread.cpp)
add_library(ui STATIC add_library(ui STATIC
qt_ui.cpp qt_ui.cpp
qt_cdrom.c qt_cdrom.c
qt_sdl.c
qt_mainwindow.cpp qt_mainwindow.cpp
qt_mainwindow.hpp qt_mainwindow.hpp

View File

@@ -13,8 +13,6 @@
#include <86box/timer.h> #include <86box/timer.h>
#include <86box/nvr.h> #include <86box/nvr.h>
#include "qt_sdl.h"
int qt_nvr_save(void) { int qt_nvr_save(void) {
return nvr_save(); return nvr_save();
} }

View File

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

View File

@@ -7,8 +7,6 @@ extern "C" {
#include <86box/keyboard.h> #include <86box/keyboard.h>
#include <86box/plat.h> #include <86box/plat.h>
#include <86box/video.h> #include <86box/video.h>
#include "qt_sdl.h"
}; };
#include <QGuiApplication> #include <QGuiApplication>