MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / WinMain

Function WinMain

Engine/source/platformWin32/winWindow.cpp:355–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353#include "app/mainLoop.h"
354
355S32 WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, S32)
356{
357 Vector<char *> argv( __FILE__, __LINE__ );
358
359 enum { moduleNameSize = 256 };
360 char moduleName[moduleNameSize];
361#ifdef TORQUE_UNICODE
362 {
363 TCHAR buf[ moduleNameSize ];
364 GetModuleFileNameW( NULL, buf, moduleNameSize );
365 convertUTF16toUTF8( buf, moduleName );
366 }
367#else
368 GetModuleFileNameA(NULL, moduleName, moduleNameSize);
369#endif
370 argv.push_back(moduleName);
371
372 for (const char* word,*ptr = lpszCmdLine; *ptr; )
373 {
374 // Eat white space
375 for (; dIsspace(*ptr) && *ptr; ptr++)
376 ;
377
378 // Pick out the next word
379 for (word = ptr; !dIsspace(*ptr) && *ptr; ptr++)
380 ;
381
382 // Add the word to the argument list.
383 if (*word)
384 {
385 S32 len = ptr - word;
386 char *arg = (char *) dMalloc(len + 1);
387 dStrncpy(arg, word, len);
388 arg[len] = 0;
389 argv.push_back(arg);
390 }
391 }
392
393 winState.appInstance = hInstance;
394
395 S32 retVal = run(argv.size(), (const char **) argv.address());
396
397 for(U32 j = 1; j < argv.size(); j++)
398 dFree(argv[j]);
399
400 return retVal;
401}
402
403#else //TORQUE_SHARED
404

Callers

nothing calls this directly

Calls 8

convertUTF16toUTF8Function · 0.85
dIsspaceFunction · 0.85
dStrncpyFunction · 0.85
runFunction · 0.85
dFreeFunction · 0.50
push_backMethod · 0.45
sizeMethod · 0.45
addressMethod · 0.45

Tested by

no test coverage detected