| 46 | //-------------------------------------------------------------------------------------- |
| 47 | |
| 48 | HRESULT ParseCommandLine(LPWSTR lpCmdLine, ConfigInfo &config) |
| 49 | { |
| 50 | LPWSTR* argv = NULL; |
| 51 | int argc = 0; |
| 52 | |
| 53 | argv = CommandLineToArgvW(GetCommandLine(), &argc); |
| 54 | if (argv == NULL) |
| 55 | { |
| 56 | MessageBox(NULL, L"Unable to parse command line!", L"Error", MB_OK); |
| 57 | return E_FAIL; |
| 58 | } |
| 59 | |
| 60 | if (argc > 1) |
| 61 | { |
| 62 | char str[1024]; |
| 63 | int i = 1; |
| 64 | while (i < argc) |
| 65 | { |
| 66 | wcstombs(str, argv[i], 1024); |
| 67 | |
| 68 | if (strcmp(str, "-width") == 0) |
| 69 | { |
| 70 | i++; |
| 71 | wcstombs(str, argv[i], 1024); |
| 72 | config.width = atoi(str); |
| 73 | i++; |
| 74 | continue; |
| 75 | } |
| 76 | |
| 77 | if (strcmp(str, "-height") == 0) |
| 78 | { |
| 79 | i++; |
| 80 | wcstombs(str, argv[i], 1024); |
| 81 | config.height = atoi(str); |
| 82 | i++; |
| 83 | continue; |
| 84 | } |
| 85 | |
| 86 | if (strcmp(str, "-vsync") == 0) |
| 87 | { |
| 88 | i++; |
| 89 | wcstombs(str, argv[i], 1024); |
| 90 | config.vsync = (atoi(str) > 0); |
| 91 | i++; |
| 92 | continue; |
| 93 | } |
| 94 | |
| 95 | if (strcmp(str, "-scenePath") == 0) |
| 96 | { |
| 97 | i++; |
| 98 | wcstombs(str, argv[i], 1024); |
| 99 | config.scenePath = str; |
| 100 | i++; |
| 101 | continue; |
| 102 | } |
| 103 | |
| 104 | if (strcmp(str, "-scene") == 0) |
| 105 | { |