int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { g_hInstance = hInstance; g_bAppRunning = true; _OnInitInstance(hInstance); // CALL INITIALIZATION FUNCTIONS HERE CORE::_InitializeDirect3D(0, 0, D3DFMT_A8R8G8B8, g_hMainWnd, true); CORE::_InitializeCOREDrawing3D(0, 0, 800, 600); _OnInitialize(); Keyboard::_Initialize(); MSG msg; while(g_bAppRunning) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } // CALL PER FRAME FUNCTIONS HERE (for now) _OnFrame(); } // CALL UNINITIALIZATION FUNCTIONS HERE _OnUninitialize(); CORE::_UninitializeCOREDrawing3D(); CORE::_UninitializeDirect3D(); return 0; }
bool Application::Initialize(const std::string& configDataPath, OPTIONAL HINSTANCE appInstanceHandler) { this->_SetResourcesPath(); this->_configDataPath = configDataPath; auto logger = Logger::Create(); if (false == Deserialize(ExtendString::Format("%s\\%s", _resourcesPath.c_str(), _configDataPath.c_str()).c_str())) { LOG_ERROR("Failed to deserialize a Application"); return false; } _isReplaceData = true; if (false == _CreateWindow((nullptr == appInstanceHandler) ? GetModuleHandle(nullptr) : appInstanceHandler)) { LOG_ERROR("Failed to create a WinAPI"); return false; } auto director = Director::Create(); if (false == director->Initialize(_winHandler)) { LOG_ERROR("Failed to initialize a Director"); director->Destroy(); return false; } return _OnInitialize(); }