Simplified Emulator (main)
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
|
||||
extern void qt_init(int argc, char* argv[]);
|
||||
extern int qt_execute();
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
qt_init(argc,argv);
|
||||
return qt_execute();
|
||||
}
|
||||
@@ -1,21 +1,12 @@
|
||||
#include <QApplication>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
|
||||
extern "C" {
|
||||
void qt_init(int argc, char* argv[]); //Will be called at the top of the main() function
|
||||
int qt_execute(); //Will be called after calling qt_execute
|
||||
//C Functions from the common folder
|
||||
void app_init(); //Initializes the app
|
||||
void app_process(); //Processes one eventloop of the app
|
||||
}
|
||||
|
||||
QApplication* app_ptr=NULL;
|
||||
|
||||
void qt_init(int argc, char* argv[]) {
|
||||
app_ptr = new QApplication(argc,argv);
|
||||
app_init();
|
||||
}
|
||||
|
||||
void app_loop() {
|
||||
while(!QApplication::closingDown()) {
|
||||
app_process();
|
||||
@@ -23,9 +14,13 @@ void app_loop() {
|
||||
}
|
||||
}
|
||||
|
||||
int qt_execute() {
|
||||
int main(int argc, char* argv[]) {
|
||||
QApplication app(argc,argv);
|
||||
app_init();
|
||||
|
||||
QtConcurrent::run(&app_loop);
|
||||
int ret= app_ptr->exec();
|
||||
delete app_ptr;
|
||||
return ret;
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user