54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
#include "app/Application.h"
|
|
|
|
#include "common/RecourceHelper.h"
|
|
#include "workspace/WorkSpaceManager.h"
|
|
#include "entities/EntitiesManager.h"
|
|
#include "viewer/OsgViewer.h"
|
|
#include "scene/MeshManager.h"
|
|
#include "network/NetDriver.h"
|
|
#include "python/PythonModule.h"
|
|
|
|
|
|
Application::Application(int& argc, char** argv, int /*= ApplicationFlags*/)
|
|
: QApplication(argc, argv) {
|
|
|
|
Init();
|
|
}
|
|
|
|
Application::~Application() {
|
|
}
|
|
|
|
QString Application::GetWorkSpacePath() {
|
|
const QString path = QString("%1/workspace").arg(applicationDirPath());
|
|
return path;
|
|
}
|
|
|
|
QString Application::GetBinPath() {
|
|
return applicationDirPath();
|
|
}
|
|
|
|
void Application::Init() {
|
|
Singleton<MeshManager>::Create(this);
|
|
Singleton<RecourceHelper>::Create(this);
|
|
Singleton<EntitiesManager>::Create(this);
|
|
Singleton<WorkSpaceManager>::Create(this);
|
|
Singleton<NetDriver>::Create(this);
|
|
//Singleton<PythonModule>::Create(this);
|
|
|
|
connect(&timer_, &QTimer::timeout, this, &Application::OnTimeout);
|
|
timer_.start(1000 / 60); // 60 FPS
|
|
}
|
|
|
|
void Application::OnTimeout() {
|
|
WorkSpaceManager::Get().OnFrame();
|
|
}
|
|
|
|
void Application::Uninit() {
|
|
//Singleton<PythonModule>::Destory();
|
|
Singleton<NetDriver>::Destory();
|
|
Singleton<WorkSpaceManager>::Destory();
|
|
Singleton<EntitiesManager>::Destory();
|
|
Singleton<RecourceHelper>::Destory();
|
|
Singleton<MeshManager>::Destory();
|
|
}
|