MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / InitInstance

Function InitInstance

Source/TestRenderer/WinMain.cpp:212–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212BOOL 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
250void ShutdownInstance() {
251 app.FreeResources();

Callers 1

_tWinMainFunction · 0.70

Calls 8

CreateMainWindowFunction · 0.85
CreateSubWindowFunction · 0.85
LoadResourcesMethod · 0.80
c_strMethod · 0.45
InitMethod · 0.45
CreateContextMethod · 0.45
SetContextDisplayFuncMethod · 0.45
CreateRenderTargetMethod · 0.45

Tested by

no test coverage detected