1 // stb_wingraph.h v0.01 - public domain windows graphics programming
2 // wraps WinMain, ChoosePixelFormat, ChangeDisplayResolution, etc. for
3 // doing OpenGL graphics
5 // in ONE source file, put '#define STB_DEFINE' before including this
6 // OR put '#define STB_WINMAIN' to define a WinMain that calls stbwingraph_main(void)
9 // 2d rendering interface (that can be done easily in software)
10 // STB_WINGRAPH_SOFTWARE -- 2d software rendering only
11 // STB_WINGRAPH_OPENGL -- OpenGL only
14 #ifndef INCLUDE_STB_WINGRAPH_H
15 #define INCLUDE_STB_WINGRAPH_H
20 #define STB_WINGRAPH_DISABLE_DEFINE_AT_END
25 #pragma comment(lib, "opengl32.lib")
26 #pragma comment(lib, "glu32.lib")
27 #pragma comment(lib, "winmm.lib")
28 #pragma comment(lib, "gdi32.lib")
29 #pragma comment(lib, "user32.lib")
33 #define STB_EXTERN extern "C"
46 #define _WIN32_WINNT 0x0400 // WM_MOUSEWHEEL
56 typedef void * stbwingraph_hwnd
;
57 typedef void * stbwingraph_hinstance
;
61 STBWINGRAPH_unprocessed
= -(1 << 24),
62 STBWINGRAPH_do_not_show
,
63 STBWINGRAPH_winproc_exit
,
64 STBWINGRAPH_winproc_update
,
65 STBWINGRAPH_update_exit
,
66 STBWINGRAPH_update_pause
,
74 STBWGE_create_postshow
,
87 STBWGE_leftdown
, STBWGE_leftup
,
88 STBWGE_middledown
, STBWGE_middleup
,
89 STBWGE_rightdown
, STBWGE_rightup
,
91 } stbwingraph_event_type
;
95 stbwingraph_event_type type
;
97 // for input events (mouse, keyboard)
98 int mx
,my
; // mouse x & y
100 int shift
, ctrl
, alt
;
102 // for keyboard events
109 int did_share_lists
; // if true, wglShareLists succeeded
115 typedef int (*stbwingraph_window_proc
)(void *data
, stbwingraph_event
*event
);
117 extern stbwingraph_hinstance stbwingraph_app
;
118 extern stbwingraph_hwnd stbwingraph_primary_window
;
119 extern int stbwingraph_request_fullscreen
;
120 extern int stbwingraph_request_windowed
;
122 STB_EXTERN
void stbwingraph_ods(char *str
, ...);
123 STB_EXTERN
int stbwingraph_MessageBox(stbwingraph_hwnd win
, unsigned int type
,
124 char *caption
, char *text
, ...);
125 STB_EXTERN
int stbwingraph_ChangeResolution(unsigned int w
, unsigned int h
,
126 unsigned int bits
, int use_message_box
);
127 STB_EXTERN
int stbwingraph_SetPixelFormat(stbwingraph_hwnd win
, int color_bits
,
128 int alpha_bits
, int depth_bits
, int stencil_bits
, int accum_bits
);
129 STB_EXTERN
int stbwingraph_DefineClass(void *hinstance
, char *iconname
);
130 STB_EXTERN
void stbwingraph_SwapBuffers(void *win
);
131 STB_EXTERN
void stbwingraph_Priority(int n
);
133 STB_EXTERN
void stbwingraph_MakeFonts(void *window
, int font_base
);
134 STB_EXTERN
void stbwingraph_ShowWindow(void *window
);
135 STB_EXTERN
void *stbwingraph_CreateWindow(int primary
, stbwingraph_window_proc func
, void *data
, char *text
, int width
, int height
, int fullscreen
, int resizeable
, int dest_alpha
, int stencil
);
136 STB_EXTERN
void *stbwingraph_CreateWindowSimple(stbwingraph_window_proc func
, int width
, int height
);
137 STB_EXTERN
void *stbwingraph_CreateWindowSimpleFull(stbwingraph_window_proc func
, int fullscreen
, int ww
, int wh
, int fw
, int fh
);
138 STB_EXTERN
void stbwingraph_DestroyWindow(void *window
);
139 STB_EXTERN
void stbwingraph_ShowCursor(void *window
, int visible
);
140 STB_EXTERN
float stbwingraph_GetTimestep(float minimum_time
);
141 STB_EXTERN
void stbwingraph_SetGLWindow(void *win
);
142 typedef int (*stbwingraph_update
)(float timestep
, int real
, int in_client
);
143 STB_EXTERN
int stbwingraph_MainLoop(stbwingraph_update func
, float mintime
);
146 stbwingraph_hinstance stbwingraph_app
;
147 stbwingraph_hwnd stbwingraph_primary_window
;
148 int stbwingraph_request_fullscreen
;
149 int stbwingraph_request_windowed
;
151 void stbwingraph_ods(char *str
, ...)
156 vsprintf(buffer
, str
, v
);
158 OutputDebugString(buffer
);
161 int stbwingraph_MessageBox(stbwingraph_hwnd win
, unsigned int type
, char *caption
, char *text
, ...)
166 vsprintf(buffer
, text
, v
);
168 return MessageBox(win
, buffer
, caption
, type
);
171 void stbwingraph_Priority(int n
)
175 case -1: p
= THREAD_PRIORITY_BELOW_NORMAL
; break;
176 case 0: p
= THREAD_PRIORITY_NORMAL
; break;
177 case 1: p
= THREAD_PRIORITY_ABOVE_NORMAL
; break;
179 if (n
< 0) p
= THREAD_PRIORITY_LOWEST
;
180 else p
= THREAD_PRIORITY_HIGHEST
;
182 SetThreadPriority(GetCurrentThread(), p
);
185 static void stbwingraph_ResetResolution(void)
187 ChangeDisplaySettings(NULL
, 0);
190 static void stbwingraph_RegisterResetResolution(void)
195 atexit(stbwingraph_ResetResolution
);
199 int stbwingraph_ChangeResolution(unsigned int w
, unsigned int h
, unsigned int bits
, int use_message_box
)
206 int success
= EnumDisplaySettings(NULL
, i
, &mode
);
208 if (mode
.dmBitsPerPel
== bits
&& mode
.dmPelsWidth
== w
&& mode
.dmPelsHeight
== h
) {
210 success
= ChangeDisplaySettings(&mode
, CDS_FULLSCREEN
);
211 if (success
== DISP_CHANGE_SUCCESSFUL
) {
212 stbwingraph_RegisterResetResolution();
221 stbwingraph_MessageBox(stbwingraph_primary_window
, MB_ICONERROR
, NULL
, "The resolution %d x %d x %d-bits is not supported.", w
, h
, bits
);
225 // we tried but failed, so try explicitly doing it without specifying refresh rate
227 // Win95 support logic
228 mode
.dmBitsPerPel
= bits
;
229 mode
.dmPelsWidth
= w
;
230 mode
.dmPelsHeight
= h
;
231 mode
.dmFields
= DM_BITSPERPEL
| DM_PELSWIDTH
| DM_PELSHEIGHT
;
233 res
= ChangeDisplaySettings(&mode
, CDS_FULLSCREEN
);
236 case DISP_CHANGE_SUCCESSFUL
:
237 stbwingraph_RegisterResetResolution();
240 case DISP_CHANGE_RESTART
:
242 stbwingraph_MessageBox(stbwingraph_primary_window
, MB_ICONERROR
, NULL
, "Please set your desktop to %d-bit color and then try again.");
245 case DISP_CHANGE_FAILED
:
247 stbwingraph_MessageBox(stbwingraph_primary_window
, MB_ICONERROR
, NULL
, "The hardware failed to change modes.");
250 case DISP_CHANGE_BADMODE
:
252 stbwingraph_MessageBox(stbwingraph_primary_window
, MB_ICONERROR
, NULL
, "The resolution %d x %d x %d-bits is not supported.", w
, h
, bits
);
257 stbwingraph_MessageBox(stbwingraph_primary_window
, MB_ICONERROR
, NULL
, "An unknown error prevented a change to a %d x %d x %d-bit display.", w
, h
, bits
);
262 int stbwingraph_SetPixelFormat(stbwingraph_hwnd win
, int color_bits
, int alpha_bits
, int depth_bits
, int stencil_bits
, int accum_bits
)
265 PIXELFORMATDESCRIPTOR pfd
= { sizeof(pfd
) };
269 pfd
.dwFlags
= PFD_SUPPORT_OPENGL
| PFD_DRAW_TO_WINDOW
| PFD_DOUBLEBUFFER
;
270 pfd
.dwLayerMask
= PFD_MAIN_PLANE
;
271 pfd
.iPixelType
= PFD_TYPE_RGBA
;
272 pfd
.cColorBits
= color_bits
;
273 pfd
.cAlphaBits
= alpha_bits
;
274 pfd
.cDepthBits
= depth_bits
;
275 pfd
.cStencilBits
= stencil_bits
;
276 pfd
.cAccumBits
= accum_bits
;
278 pixel_format
= ChoosePixelFormat(dc
, &pfd
);
279 if (!pixel_format
) return FALSE
;
281 if (!DescribePixelFormat(dc
, pixel_format
, sizeof(PIXELFORMATDESCRIPTOR
), &pfd
))
283 SetPixelFormat(dc
, pixel_format
, &pfd
);
291 stbwingraph_window_proc func
;
293 // creation parameters
294 int color
, alpha
, depth
, stencil
, accum
;
304 int mx
,my
; // last mouse positions
305 } stbwingraph__window
;
307 static void stbwingraph__inclient(stbwingraph__window
*win
, int state
)
309 if (state
!= win
->in_client
) {
310 win
->in_client
= state
;
316 static void stbwingraph__key(stbwingraph_event
*e
, int type
, int key
, stbwingraph__window
*z
)
320 e
->shift
= (GetKeyState(VK_SHIFT
) < 0);
321 e
->ctrl
= (GetKeyState(VK_CONTROL
) < 0);
322 e
->alt
= (GetKeyState(VK_MENU
) < 0);
332 static void stbwingraph__mouse(stbwingraph_event
*e
, int type
, WPARAM wparam
, LPARAM lparam
, int capture
, void *wnd
, stbwingraph__window
*z
)
334 static int captured
= 0;
336 e
->mx
= (short) LOWORD(lparam
);
337 e
->my
= (short) HIWORD(lparam
);
338 if (!z
|| z
->mx
== -(1 << 30)) {
341 e
->dx
= e
->mx
- z
->mx
;
342 e
->dy
= e
->my
- z
->my
;
344 e
->shift
= (wparam
& MK_SHIFT
) != 0;
345 e
->ctrl
= (wparam
& MK_CONTROL
) != 0;
346 e
->alt
= (wparam
& MK_ALT
) != 0;
352 if (!captured
&& capture
== 1)
355 if (!captured
&& capture
== -1)
357 if (captured
< 0) captured
= 0;
361 static void stbwingraph__mousewheel(stbwingraph_event
*e
, int type
, WPARAM wparam
, LPARAM lparam
, int capture
, void *wnd
, stbwingraph__window
*z
)
363 // lparam seems bogus!
364 static int captured
= 0;
371 e
->shift
= (wparam
& MK_SHIFT
) != 0;
372 e
->ctrl
= (wparam
& MK_CONTROL
) != 0;
373 e
->alt
= (GetKeyState(VK_MENU
) < 0);
374 e
->key
= ((int) wparam
>> 16);
377 int stbwingraph_force_update
;
378 static int WINAPI
stbwingraph_WinProc(HWND wnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
)
380 int allow_default
= TRUE
;
381 stbwingraph_event e
= { STBWGE__none
};
382 // the following line is wrong for 64-bit windows, but VC6 doesn't have GetWindowLongPtr
383 stbwingraph__window
*z
= (stbwingraph__window
*) GetWindowLong(wnd
, GWL_USERDATA
);
389 LPCREATESTRUCT lpcs
= (LPCREATESTRUCT
) lparam
;
391 z
= (stbwingraph__window
*) lpcs
->lpCreateParams
;
392 SetWindowLong(wnd
, GWL_USERDATA
, (LONG
) z
);
394 if (stbwingraph_SetPixelFormat(wnd
, z
->color
, z
->alpha
, z
->depth
, z
->stencil
, z
->accum
)) {
395 z
->rc
= wglCreateContext(z
->dc
);
397 e
.type
= STBWGE_create
;
398 z
->did_share_lists
= FALSE
;
399 if (z
->share_window
) {
400 stbwingraph__window
*y
= (stbwingraph__window
*) GetWindowLong(z
->share_window
, GWL_USERDATA
);
401 if (wglShareLists(z
->rc
, y
->rc
))
402 z
->did_share_lists
= TRUE
;
404 wglMakeCurrent(z
->dc
, z
->rc
);
413 HDC hdc
= BeginPaint(wnd
, &ps
);
414 SelectObject(hdc
, GetStockObject(NULL_BRUSH
));
415 e
.type
= STBWGE_draw
;
417 z
->func(z
->data
, &e
);
423 e
.type
= STBWGE_destroy
;
426 z
->func(z
->data
, &e
);
427 wglMakeCurrent(NULL
, NULL
) ;
429 if (z
->rc
) wglDeleteContext(z
->rc
);
433 if (wnd
== stbwingraph_primary_window
)
437 case WM_CHAR
: stbwingraph__key(&e
, STBWGE_char
, wparam
, z
); break;
438 case WM_KEYDOWN
: stbwingraph__key(&e
, STBWGE_keydown
, wparam
, z
); break;
439 case WM_KEYUP
: stbwingraph__key(&e
, STBWGE_keyup
, wparam
, z
); break;
441 case WM_NCMOUSEMOVE
: stbwingraph__inclient(z
,0); break;
442 case WM_MOUSEMOVE
: stbwingraph__inclient(z
,1); stbwingraph__mouse(&e
, STBWGE_mousemove
, wparam
, lparam
,0,wnd
, z
); break;
443 case WM_LBUTTONDOWN
: stbwingraph__mouse(&e
, STBWGE_leftdown
, wparam
, lparam
,1,wnd
, z
); break;
444 case WM_MBUTTONDOWN
: stbwingraph__mouse(&e
, STBWGE_middledown
, wparam
, lparam
,1,wnd
, z
); break;
445 case WM_RBUTTONDOWN
: stbwingraph__mouse(&e
, STBWGE_rightdown
, wparam
, lparam
,1,wnd
, z
); break;
446 case WM_LBUTTONUP
: stbwingraph__mouse(&e
, STBWGE_leftup
, wparam
, lparam
,-1,wnd
, z
); break;
447 case WM_MBUTTONUP
: stbwingraph__mouse(&e
, STBWGE_middleup
, wparam
, lparam
,-1,wnd
, z
); break;
448 case WM_RBUTTONUP
: stbwingraph__mouse(&e
, STBWGE_rightup
, wparam
, lparam
,-1,wnd
, z
); break;
449 case WM_MOUSEWHEEL
: stbwingraph__mousewheel(&e
, STBWGE_mousewheel
, wparam
, lparam
,0,wnd
, z
); break;
452 allow_default
= FALSE
;
453 if (LOWORD(wparam
)==WA_INACTIVE
) {
454 wglMakeCurrent(z
->dc
, NULL
);
455 e
.type
= STBWGE_deactivate
;
458 wglMakeCurrent(z
->dc
, z
->rc
);
459 e
.type
= STBWGE_activate
;
463 z
->func(z
->data
, &e
);
468 allow_default
= FALSE
;
469 GetClientRect(wnd
, &rect
);
470 e
.type
= STBWGE_size
;
471 e
.width
= rect
.right
;
472 e
.height
= rect
.bottom
;
474 z
->func(z
->data
, &e
);
479 return DefWindowProc (wnd
, msg
, wparam
, lparam
);
482 if (e
.type
!= STBWGE__none
) {
485 n
= z
->func(z
->data
, &e
);
486 if (n
== STBWINGRAPH_winproc_exit
) {
490 if (n
== STBWINGRAPH_winproc_update
) {
491 stbwingraph_force_update
= TRUE
;
494 if (n
!= STBWINGRAPH_unprocessed
)
497 return DefWindowProc (wnd
, msg
, wparam
, lparam
);
500 int stbwingraph_DefineClass(HINSTANCE hInstance
, char *iconname
)
504 stbwingraph_app
= hInstance
;
506 wndclass
.cbSize
= sizeof(wndclass
);
507 wndclass
.style
= CS_OWNDC
;
508 wndclass
.lpfnWndProc
= (WNDPROC
) stbwingraph_WinProc
;
509 wndclass
.cbClsExtra
= 0;
510 wndclass
.cbWndExtra
= 0;
511 wndclass
.hInstance
= hInstance
;
512 wndclass
.hIcon
= LoadIcon(hInstance
, iconname
);
513 wndclass
.hCursor
= LoadCursor(NULL
,IDC_ARROW
);
514 wndclass
.hbrBackground
= GetStockObject(NULL_BRUSH
);
515 wndclass
.lpszMenuName
= "zwingraph";
516 wndclass
.lpszClassName
= "zwingraph";
517 wndclass
.hIconSm
= NULL
;
519 if (!RegisterClassEx(&wndclass
))
524 void stbwingraph_ShowWindow(void *window
)
526 stbwingraph_event e
= { STBWGE_create_postshow
};
527 stbwingraph__window
*z
= (stbwingraph__window
*) GetWindowLong(window
, GWL_USERDATA
);
528 ShowWindow(window
, SW_SHOWNORMAL
);
529 InvalidateRect(window
, NULL
, TRUE
);
530 UpdateWindow(window
);
532 z
->func(z
->data
, &e
);
535 void *stbwingraph_CreateWindow(int primary
, stbwingraph_window_proc func
, void *data
, char *text
,
536 int width
, int height
, int fullscreen
, int resizeable
, int dest_alpha
, int stencil
)
540 stbwingraph__window
*z
= (stbwingraph__window
*) malloc(sizeof(*z
));
542 if (z
== NULL
) return NULL
;
543 memset(z
, 0, sizeof(*z
));
546 z
->alpha
= dest_alpha
;
547 z
->stencil
= stencil
;
554 if (stbwingraph_request_windowed
)
556 else if (stbwingraph_request_fullscreen
)
562 stbwingraph_ChangeResolution(width
, height
, 32, 1);
564 if (!stbwingraph_ChangeResolution(width
, height
, 32, 0))
567 dwstyle
= WS_POPUP
| WS_CLIPSIBLINGS
;
570 dwstyle
= WS_OVERLAPPED
| WS_CAPTION
| WS_SYSMENU
| WS_MINIMIZEBOX
;
572 dwstyle
|= WS_SIZEBOX
| WS_MAXIMIZEBOX
;
576 rect
.bottom
= height
;
577 AdjustWindowRect(&rect
, dwstyle
, FALSE
);
578 width
= rect
.right
- rect
.left
;
579 height
= rect
.bottom
- rect
.top
;
582 win
= CreateWindow("zwingraph", text
? text
: "sample", dwstyle
,
583 CW_USEDEFAULT
,0, width
, height
,
584 NULL
, NULL
, stbwingraph_app
, z
);
586 if (win
== NULL
) return win
;
589 if (stbwingraph_primary_window
)
590 stbwingraph_DestroyWindow(stbwingraph_primary_window
);
591 stbwingraph_primary_window
= win
;
595 stbwingraph_event e
= { STBWGE_create
};
596 stbwingraph__window
*z
= (stbwingraph__window
*) GetWindowLong(win
, GWL_USERDATA
);
598 e
.did_share_lists
= z
->did_share_lists
;
600 if (z
->func(z
->data
, &e
) != STBWINGRAPH_do_not_show
)
601 stbwingraph_ShowWindow(win
);
607 void *stbwingraph_CreateWindowSimple(stbwingraph_window_proc func
, int width
, int height
)
611 if (width
== 640 && height
== 480) fullscreen
= 1;
612 if (width
== 800 && height
== 600) fullscreen
= 1;
613 if (width
== 1024 && height
== 768) fullscreen
= 1;
614 if (width
== 1280 && height
== 1024) fullscreen
= 1;
615 if (width
== 1600 && height
== 1200) fullscreen
= 1;
616 //@TODO: widescreen widths
618 return stbwingraph_CreateWindow(1, func
, NULL
, NULL
, width
, height
, fullscreen
, 1, 0, 0);
621 void *stbwingraph_CreateWindowSimpleFull(stbwingraph_window_proc func
, int fullscreen
, int ww
, int wh
, int fw
, int fh
)
623 if (fullscreen
== -1) {
635 return stbwingraph_CreateWindow(1, func
, NULL
, NULL
, ww
, wh
, fullscreen
, 1, 0, 0);
638 void stbwingraph_DestroyWindow(void *window
)
640 stbwingraph__window
*z
= (stbwingraph__window
*) GetWindowLong(window
, GWL_USERDATA
);
641 DestroyWindow(window
);
643 if (stbwingraph_primary_window
== window
)
644 stbwingraph_primary_window
= NULL
;
647 void stbwingraph_ShowCursor(void *window
, int visible
)
650 stbwingraph__window
*win
;
652 window
= stbwingraph_primary_window
;
653 win
= (stbwingraph__window
*) GetWindowLong((HWND
) window
, GWL_USERDATA
);
655 if (hide
!= win
->hide_mouse
) {
656 win
->hide_mouse
= hide
;
659 else if (win
->in_client
)
664 float stbwingraph_GetTimestep(float minimum_time
)
668 static double lastTime
= -1;
671 lastTime
= timeGetTime() / 1000.0 - minimum_time
;
674 thisTime
= timeGetTime() / 1000.0;
675 elapsedTime
= (float) (thisTime
- lastTime
);
676 if (elapsedTime
>= minimum_time
) {
686 void stbwingraph_SetGLWindow(void *win
)
688 stbwingraph__window
*z
= (stbwingraph__window
*) GetWindowLong(win
, GWL_USERDATA
);
690 wglMakeCurrent(z
->dc
, z
->rc
);
693 void stbwingraph_MakeFonts(void *window
, int font_base
)
695 wglUseFontBitmaps(GetDC(window
? window
: stbwingraph_primary_window
), 0, 256, font_base
);
698 // returns 1 if WM_QUIT, 0 if 'func' returned 0
699 int stbwingraph_MainLoop(stbwingraph_update func
, float mintime
)
701 int needs_drawing
= FALSE
;
704 int is_animating
= TRUE
;
705 if (mintime
<= 0) mintime
= 0.01f
;
711 // wait for a message if: (a) we're animating and there's already a message
712 // or (b) we're not animating
713 if (!is_animating
|| PeekMessage(&msg
, NULL
, 0, 0, PM_NOREMOVE
)) {
714 stbwingraph_force_update
= FALSE
;
715 if (GetMessage(&msg
, NULL
, 0, 0)) {
716 TranslateMessage(&msg
);
717 DispatchMessage(&msg
);
722 // only force a draw for certain messages...
723 // if I don't do this, we peg at 50% for some reason... must
724 // be a bug somewhere, because we peg at 100% when rendering...
725 // very weird... looks like NVIDIA is pumping some messages
726 // through our pipeline? well, ok, I guess if we can get
727 // non-user-generated messages we have to do this
728 if (!stbwingraph_force_update
) {
729 switch (msg
.message
) {
745 needs_drawing
= TRUE
;
749 needs_drawing
= TRUE
;
752 // if another message, process that first
753 // @TODO: i don't think this is working, because I can't key ahead
754 // in the SVT demo app
755 if (PeekMessage(&msg
, NULL
, 0,0, PM_NOREMOVE
))
758 // and now call update
759 if (needs_drawing
|| is_animating
) {
760 int real
=1, in_client
=1;
761 if (stbwingraph_primary_window
) {
762 stbwingraph__window
*z
= (stbwingraph__window
*) GetWindowLong(stbwingraph_primary_window
, GWL_USERDATA
);
763 if (z
&& !z
->active
) {
767 in_client
= z
->in_client
;
770 if (stbwingraph_primary_window
)
771 stbwingraph_SetGLWindow(stbwingraph_primary_window
);
772 n
= func(stbwingraph_GetTimestep(mintime
), real
, in_client
);
773 if (n
== STBWINGRAPH_update_exit
)
774 return 0; // update_quit
776 is_animating
= (n
!= STBWINGRAPH_update_pause
);
778 needs_drawing
= FALSE
;
783 void stbwingraph_SwapBuffers(void *win
)
785 stbwingraph__window
*z
;
786 if (win
== NULL
) win
= stbwingraph_primary_window
;
787 z
= (stbwingraph__window
*) GetWindowLong(win
, GWL_USERDATA
);
794 void stbwingraph_main(void);
796 char *stb_wingraph_commandline
;
798 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
)
802 // add spaces to either side of the string
804 strcpy(buffer
+1, lpCmdLine
);
806 if (strstr(buffer
, " -reset ")) {
807 ChangeDisplaySettings(NULL
, 0);
810 if (strstr(buffer
, " -window ") || strstr(buffer
, " -windowed "))
811 stbwingraph_request_windowed
= TRUE
;
812 else if (strstr(buffer
, " -full ") || strstr(buffer
, " -fullscreen "))
813 stbwingraph_request_fullscreen
= TRUE
;
815 stb_wingraph_commandline
= lpCmdLine
;
817 stbwingraph_DefineClass(hInstance
, "appicon");
825 #ifdef STB_WINGRAPH_DISABLE_DEFINE_AT_END
829 #endif // INCLUDE_STB_WINGRAPH_H