| 151 | } |
| 152 | |
| 153 | static 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 |
no test coverage detected