| 4919 | #include <shellapi.h> |
| 4920 | |
| 4921 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow) { |
| 4922 | MSG msg; // message |
| 4923 | bool done; // flag saying when app is complete |
| 4924 | int argc; |
| 4925 | char **argv; |
| 4926 | |
| 4927 | // Ensure wParam is initialized. |
| 4928 | msg.wParam = 0; |
| 4929 | |
| 4930 | // Use the CommandLine functions to get the command line arguments. |
| 4931 | // Unfortunately, Microsoft outputs |
| 4932 | // this information as wide characters for Unicode, and we simply want the |
| 4933 | // Ascii version to be compatible |
| 4934 | // with the non-Windows side. So, we have to convert the information to |
| 4935 | // Ascii character strings. |
| 4936 | LPWSTR *commandLineArgs = CommandLineToArgvW(GetCommandLineW(), &argc); |
| 4937 | if (NULL == commandLineArgs) { |
| 4938 | argc = 0; |
| 4939 | } |
| 4940 | |
| 4941 | if (argc > 0) { |
| 4942 | argv = (char **)malloc(sizeof(char *) * argc); |
| 4943 | if (argv == NULL) { |
| 4944 | argc = 0; |
| 4945 | } else { |
| 4946 | for (int iii = 0; iii < argc; iii++) { |
| 4947 | size_t wideCharLen = wcslen(commandLineArgs[iii]); |
| 4948 | size_t numConverted = 0; |
| 4949 | |
| 4950 | argv[iii] = (char *)malloc(sizeof(char) * (wideCharLen + 1)); |
| 4951 | if (argv[iii] != NULL) { |
| 4952 | wcstombs_s(&numConverted, argv[iii], wideCharLen + 1, commandLineArgs[iii], wideCharLen + 1); |
| 4953 | } |
| 4954 | } |
| 4955 | } |
| 4956 | } else { |
| 4957 | argv = NULL; |
| 4958 | } |
| 4959 | |
| 4960 | demo_init(&demo, argc, argv); |
| 4961 | |
| 4962 | // Free up the items we had to allocate for the command line arguments. |
| 4963 | if (argc > 0 && argv != NULL) { |
| 4964 | for (int iii = 0; iii < argc; iii++) { |
| 4965 | if (argv[iii] != NULL) { |
| 4966 | free(argv[iii]); |
| 4967 | } |
| 4968 | } |
| 4969 | free(argv); |
| 4970 | } |
| 4971 | |
| 4972 | demo.connection = hInstance; |
| 4973 | strncpy(demo.name, "Vulkan Cube", APP_NAME_STR_LEN); |
| 4974 | demo_create_window(&demo); |
| 4975 | demo_create_surface(&demo); |
| 4976 | demo_select_physical_device(&demo); |
| 4977 | demo_init_vk_swapchain(&demo); |
| 4978 |
nothing calls this directly
no test coverage detected