[323] | 1 | #include <windows.h>
|
---|
| 2 |
|
---|
| 3 | #include "Daodan.h"
|
---|
| 4 | #include "Daodan_Win32.h"
|
---|
| 5 |
|
---|
[692] | 6 | #include "Oni.h"
|
---|
[326] | 7 |
|
---|
[677] | 8 | extern HWND onihwnd;
|
---|
[692] | 9 |
|
---|
[323] | 10 | short ONICALL DDrPlatform_Initialize(ONtPlatformData *PlatformData)
|
---|
| 11 | {
|
---|
| 12 | WNDCLASSEX WndClass;
|
---|
| 13 | RECT Rect;
|
---|
| 14 | const int Width = 640, Height = 480;
|
---|
[677] | 15 | HINSTANCE temp_Instance = PlatformData->Instance;
|
---|
[323] | 16 |
|
---|
| 17 | PlatformData->Instance = g_Instance;
|
---|
| 18 |
|
---|
| 19 | WndClass.cbSize = sizeof(WndClass);
|
---|
[326] | 20 | WndClass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
|
---|
[323] | 21 | WndClass.cbClsExtra = 0;
|
---|
| 22 | WndClass.cbWndExtra = 0;
|
---|
| 23 | WndClass.hInstance = PlatformData->Instance;
|
---|
| 24 | WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
---|
[677] | 25 | WndClass.hIcon = LoadIcon(g_Instance, MAKEINTRESOURCE(103) );
|
---|
| 26 | WndClass.hIconSm = LoadIcon(g_Instance, MAKEINTRESOURCE(103));
|
---|
[323] | 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;
|
---|
[476] | 38 | AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW , FALSE);
|
---|
[677] | 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;
|
---|
[323] | 41 | ShowWindow(PlatformData->Window, SW_SHOWNORMAL);
|
---|
| 42 | UpdateWindow(PlatformData->Window);
|
---|
| 43 |
|
---|
| 44 | ShowCursor(FALSE);
|
---|
[326] | 45 |
|
---|
| 46 | // I dont know why this is needed but Oni doesn't init without it.
|
---|
| 47 | ONgPlatformData.Window = PlatformData->Window;
|
---|
[677] | 48 | ONgPlatformData.Instance = PlatformData->Instance;
|
---|
[326] | 49 |
|
---|
[323] | 50 | return 0;
|
---|
| 51 | }
|
---|
[692] | 52 |
|
---|