#include "ECTrainer.h"
#include "ECTrainerGUI.h"
#include "SceneCamera.h"
// コンストラクタ
ECTrainer::ECTrainer()
: _pGui(NULL)
, _pSceneCam(NULL)
, _Running(true)
{
_pGui = new ECTrainerGUI(this);
_pSceneCam = new SceneCamera(this);
}
// デストラクタ
ECTrainer::~ECTrainer() {
if (_pGui) delete _pGui;
if (_pSceneCam) delete _pSceneCam;
}
// 初期化
bool ECTrainer::Process() {
if (!_pGui->Init()) return false;
if (!_pSceneCam->Init()) return false;
DWORD dwThreadId;
HANDLE hThSceneCam = CreateThread(NULL, 0, SceneCamThreadEntry, this, 0, &dwThreadId);
_pGui->MainLoop();
if (WaitForSingleObject(hThSceneCam, 1000) == WAIT_OBJECT_0) {
#ifdef _DEBUG
std::cout << "Scene Cam thread end." << std::endl;
#endif
}
CloseHandle(hThSceneCam);
return true;
}
DWORD WINAPI ECTrainer::SceneCamThreadEntry(LPVOID lpParameter) {
((ECTrainer*)lpParameter)->_pSceneCam->MainLoop();
return 0;
}