| 210 | } |
| 211 | |
| 212 | BOOL InitInstance(int nCmdShow) { |
| 213 | BE1::Str basePath = BE1::PlatformFile::ExecutablePath(); |
| 214 | basePath.AppendPath("../../.."); |
| 215 | basePath.CleanPath(); |
| 216 | BE1::Engine::InitBase(basePath.c_str(), false, SystemLog, SystemError); |
| 217 | |
| 218 | char temp[128]; |
| 219 | BE1::Str::snPrintf(temp, sizeof(temp), "%ls %s %s %s", szTitle, BE1::PlatformProcess::PlatformName(), __DATE__, __TIME__); |
| 220 | |
| 221 | wchar_t szFullTitle[128]; |
| 222 | BE1::PlatformWinUtils::UTF8ToUCS2(temp, szFullTitle, COUNT_OF(szFullTitle)); |
| 223 | |
| 224 | HWND hwndMain = CreateMainWindow(szFullTitle, 1024, 768); |
| 225 | |
| 226 | app.Init(hwndMain); |
| 227 | |
| 228 | app.LoadResources(); |
| 229 | |
| 230 | mainContext = BE1::rhi.CreateContext(hwndMain, USE_SHARED_CONTEXT); |
| 231 | |
| 232 | BE1::rhi.SetContextDisplayFunc(mainContext, DisplayMainContext, nullptr, false); |
| 233 | |
| 234 | // FBO cannot be shared, so we should create FBO for each context |
| 235 | mainRenderTarget = app.CreateRenderTarget(mainContext); |
| 236 | |
| 237 | #ifdef CREATE_SUB_WINDOW |
| 238 | HWND hwndSub = CreateSubWindow(_T("sub window"), 512, 384); |
| 239 | |
| 240 | subContext = BE1::rhi.CreateContext(hwndSub, USE_SHARED_CONTEXT); |
| 241 | |
| 242 | BE1::rhi.SetContextDisplayFunc(subContext, DisplaySubContext, nullptr, false); |
| 243 | |
| 244 | subRenderTarget = app.CreateRenderTarget(subContext); |
| 245 | #endif |
| 246 | |
| 247 | return TRUE; |
| 248 | } |
| 249 | |
| 250 | void ShutdownInstance() { |
| 251 | app.FreeResources(); |
no test coverage detected