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

Function InitInstance

Source/Player/WinMain.cpp:153–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153static void InitInstance(HINSTANCE hInstance, LPCTSTR lpCmdLine, int nCmdShow) {
154 BE1::Engine::InitParms initParms;
155
156 //BE1::Str cmdLine = Str::UTF8StrFromWCharString(lpCmdLine);
157 //initParms.args.TokenizeString(cmdLine, false);
158
159 BE1::Str playerDir;
160#if 0
161 playerDir = BE1::PlatformFile::Cwd();
162#else
163 playerDir = BE1::PlatformFile::ExecutablePath();
164 playerDir.AppendPath("..\\..\\..");
165#endif
166 playerDir.CleanPath(PATHSEPERATOR_CHAR);
167
168 if (lpCmdLine[0]) {
169 playerDir = lpCmdLine;
170 }
171
172 initParms.baseDir = playerDir;
173
174 BE1::Str dataDir = playerDir + "\\Data";
175
176 BE1::Str assetDir = dataDir;
177 assetDir.AppendPath("Contents", '/');
178
179 initParms.searchPath = assetDir + ";" + dataDir;
180
181 BE1::Engine::Init(&initParms);
182
183 if (!BE1::resourceGuidMapper.Read("Data\\guidmap")) {
184 BE_FATALERROR("Couldn't open guidmap !");
185 }
186
187 WNDCLASSEX wcex;
188 memset(&wcex, 0, sizeof(wcex));
189 wcex.cbSize = sizeof(WNDCLASSEX);
190 wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
191 wcex.lpfnWndProc = WndProc;
192 wcex.hInstance = hInstance;
193 wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_GAME));
194 wcex.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_GAME));
195 wcex.hbrBackground = (HBRUSH)(COLOR_GRAYTEXT + 1);
196 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
197 wcex.lpszMenuName = MAKEINTRESOURCE(IDC_GAME);
198 wcex.lpszClassName = mainWindowClassName;
199 RegisterClassEx(&wcex);
200
201 char temp[128];
202 BE1::Str::snPrintf(temp, sizeof(temp), "%ls %s %s %s", szTitle, BE1::PlatformProcess::PlatformName(), __DATE__, __TIME__);
203
204 wchar_t szFullTitle[128];
205 BE1::PlatformWinUtils::UTF8ToUCS2(temp, szFullTitle, COUNT_OF(szFullTitle));
206
207 hmainWnd = CreateRenderWindow(szFullTitle, mainWindowClassName, disp_width.GetInteger(), disp_height.GetInteger(), disp_fullscreen.GetBool());
208
209 BE1::renderSystem.InitRHI(hmainWnd);
210

Callers 1

_tWinMainFunction · 0.70

Calls 12

InitRHIMethod · 0.80
AllocRenderContextMethod · 0.80
OnResizeMethod · 0.80
GetContextHandleMethod · 0.80
LoadAppScriptMethod · 0.80
StartAppScriptMethod · 0.80
CreateRenderWindowFunction · 0.70
ReadMethod · 0.45
GetBoolMethod · 0.45
InitMethod · 0.45
OnApplicationResizeMethod · 0.45
SetFullscreenMethod · 0.45

Tested by

no test coverage detected