MCPcopy Create free account
hub / github.com/DentonW/DevIL / WinMain

Function WinMain

DevIL/examples/animation_example/AnimTest.cpp:57–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56
57int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
58{
59 MSG msg;
60 WNDCLASSEX wcex;
61 HACCEL hAccelTable;
62
63 hInstance = hInst;
64
65 wcex.cbSize = sizeof(WNDCLASSEX);
66
67 wcex.style = CS_HREDRAW | CS_VREDRAW;
68 wcex.lpfnWndProc = (WNDPROC)WndProc;
69 wcex.cbClsExtra = 0;
70 wcex.cbWndExtra = 0;
71 wcex.hInstance = hInstance;
72 wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
73 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
74 wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
75 wcex.lpszMenuName = (LPCSTR)IDR_MENU1;
76 wcex.lpszClassName = TITLE;
77 wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_ICON1);
78
79 RegisterClassEx(&wcex);
80
81 HWnd = CreateWindow(TITLE, TITLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
82 50, 50, 400, 300, NULL, NULL, hInstance, NULL);
83 if (HWnd == NULL)
84 return FALSE;
85
86 // Display the window
87 ShowWindow(HWnd, nCmdShow);
88 UpdateWindow(HWnd);
89
90 ilInit();
91 ilEnable(IL_ORIGIN_SET);
92 ilEnable(IL_TYPE_SET);
93 ilEnable(IL_FORMAT_SET);
94
95 ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
96 ilTypeFunc(IL_UNSIGNED_BYTE);
97 ilFormatFunc(IL_BGR);
98
99 // Is there a file to load from the command-line?
100 if (__argc > 1) {
101 LoadImages(__argv[1]);
102 }
103
104 hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDR_MENU1);
105
106 while (GetMessage(&msg, NULL, 0, 0)) {
107 if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
108 TranslateMessage(&msg);
109 DispatchMessage(&msg);
110 }
111 }
112
113 return msg.wParam;
114}

Callers

nothing calls this directly

Calls 1

LoadImagesFunction · 0.85

Tested by

no test coverage detected