/[pcsx2_0.9.7]/trunk/3rdparty/SDL-1.3.0-5387/test/testnativew32.c
ViewVC logotype

Contents of /trunk/3rdparty/SDL-1.3.0-5387/test/testnativew32.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 401 - (show annotations) (download)
Fri Feb 25 17:31:09 2011 UTC (9 years, 9 months ago) by william
File MIME type: text/plain
File size: 1668 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4358 local: v0.9.7.313-latest) in ./trunk
1
2 #include "testnative.h"
3
4 #ifdef TEST_NATIVE_WINDOWS
5
6 static void *CreateWindowNative(int w, int h);
7 static void DestroyWindowNative(void *window);
8
9 NativeWindowFactory WindowsWindowFactory = {
10 "windows",
11 CreateWindowNative,
12 DestroyWindowNative
13 };
14
15 LRESULT CALLBACK
16 WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
17 {
18 switch (msg) {
19 case WM_CLOSE:
20 DestroyWindow(hwnd);
21 break;
22 case WM_DESTROY:
23 PostQuitMessage(0);
24 break;
25 default:
26 return DefWindowProc(hwnd, msg, wParam, lParam);
27 }
28 return 0;
29 }
30
31 static void *
32 CreateWindowNative(int w, int h)
33 {
34 HWND hwnd;
35 WNDCLASS wc;
36
37 wc.style = 0;
38 wc.lpfnWndProc = WndProc;
39 wc.cbClsExtra = 0;
40 wc.cbWndExtra = 0;
41 wc.hInstance = GetModuleHandle(NULL);
42 wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
43 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
44 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
45 wc.lpszMenuName = NULL;
46 wc.lpszClassName = "SDL Test";
47
48 if (!RegisterClass(&wc)) {
49 MessageBox(NULL, "Window Registration Failed!", "Error!",
50 MB_ICONEXCLAMATION | MB_OK);
51 return 0;
52 }
53
54 hwnd =
55 CreateWindow("SDL Test", "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
56 CW_USEDEFAULT, w, h, NULL, NULL, GetModuleHandle(NULL),
57 NULL);
58 if (hwnd == NULL) {
59 MessageBox(NULL, "Window Creation Failed!", "Error!",
60 MB_ICONEXCLAMATION | MB_OK);
61 return 0;
62 }
63
64 ShowWindow(hwnd, SW_SHOW);
65
66 return hwnd;
67 }
68
69 static void
70 DestroyWindowNative(void *window)
71 {
72 DestroyWindow((HWND) window);
73 }
74
75 #endif

  ViewVC Help
Powered by ViewVC 1.1.22