source: Daodan/MSVC/Daodan_Win32.c@ 833

Last change on this file since 833 was 569, checked in by gumby, 14 years ago

Fixes, fixes, everywhere

File size: 1.8 KB
Line 
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"
9extern HWND onihwnd;
10short ONICALL DDrPlatform_Initialize(ONtPlatformData *PlatformData)
11{
12 WNDCLASSEX WndClass;
13 RECT Rect;
14 const int Width = 640, Height = 480;
15 HINSTANCE temp_Instance = PlatformData->Instance;
16
17 PlatformData->Instance = g_Instance;
18
19 WndClass.cbSize = sizeof(WndClass);
20 WndClass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
21 WndClass.cbClsExtra = 0;
22 WndClass.cbWndExtra = 0;
23 WndClass.hInstance = PlatformData->Instance;
24 WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
25 WndClass.hIcon = LoadIcon(g_Instance, MAKEINTRESOURCE(103) );
26 WndClass.hIconSm = LoadIcon(g_Instance, MAKEINTRESOURCE(103));
27 WndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
28 WndClass.lpszMenuName = NULL;
29 WndClass.lpszClassName = "ONI ";
30 WndClass.lpfnWndProc = ONrPlatform_WindowProc;
31
32 RegisterClassEx(&WndClass);
33
34 Rect.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (Width / 2);
35 Rect.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (Height / 2);
36 Rect.right = Rect.left + Width;
37 Rect.bottom = Rect.top + Height;
38 AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW , FALSE);
39 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);
40 onihwnd = PlatformData->Window;
41 ShowWindow(PlatformData->Window, SW_SHOWNORMAL);
42 UpdateWindow(PlatformData->Window);
43
44 ShowCursor(FALSE);
45
46 // I dont know why this is needed but Oni doesn't init without it.
47 ONgPlatformData.Window = PlatformData->Window;
48 ONgPlatformData.Instance = PlatformData->Instance;
49
50 return 0;
51}
Note: See TracBrowser for help on using the repository browser.