ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan_Win32.c
Revision: 492
Committed: Sat Jan 30 01:16:49 2010 UTC (15 years, 8 months ago) by rossy
Content type: text/x-csrc
File size: 1705 byte(s)
Log Message:
hopefully a fix

File Contents

# Content
1 #include <windows.h>
2
3 #include "Daodan.h"
4 #include "Daodan_Win32.h"
5
6 #include "BFW_Utility.h"
7
8 #include "Oni.h"
9
10 short ONICALL DDrPlatform_Initialize(ONtPlatformData *PlatformData)
11 {
12 WNDCLASSEX WndClass;
13 RECT Rect;
14 const int Width = 640, Height = 480;
15
16 PlatformData->Instance = g_Instance;
17
18 WndClass.cbSize = sizeof(WndClass);
19 WndClass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
20 WndClass.cbClsExtra = 0;
21 WndClass.cbWndExtra = 0;
22 WndClass.hInstance = PlatformData->Instance;
23 WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
24 WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
25 WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
26 WndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
27 WndClass.lpszMenuName = NULL;
28 WndClass.lpszClassName = "ONI ";
29 WndClass.lpfnWndProc = ONrPlatform_WindowProc;
30
31 RegisterClassEx(&WndClass);
32
33 Rect.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (Width / 2);
34 Rect.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (Height / 2);
35 Rect.right = Rect.left + Width;
36 Rect.bottom = Rect.top + Height;
37 AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW , FALSE);
38 PlatformData->Window = CreateWindowEx(0, "ONI ", "ONI ", WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, NULL, PlatformData->Instance, NULL);
39
40 ShowWindow(PlatformData->Window, SW_SHOWNORMAL);
41 UpdateWindow(PlatformData->Window);
42
43 ShowCursor(FALSE);
44
45 // I dont know why this is needed but Oni doesn't init without it.
46 ONgPlatformData.Window = PlatformData->Window;
47 //ONgPlatformData.Instance = PlatformData->Instance;
48
49 return 0;
50 }