[323] | 1 | #include <windows.h>
|
---|
| 2 |
|
---|
| 3 | #include "Daodan.h"
|
---|
| 4 | #include "Daodan_Win32.h"
|
---|
| 5 |
|
---|
[326] | 6 | #include "BFW_Utility.h"
|
---|
| 7 |
|
---|
[323] | 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);
|
---|
[326] | 19 | WndClass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
|
---|
[323] | 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;
|
---|
[476] | 37 | AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP | WS_TILEDWINDOW , FALSE);
|
---|
[323] | 38 |
|
---|
[476] | 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);
|
---|
[323] | 40 | ShowWindow(PlatformData->Window, SW_SHOWNORMAL);
|
---|
| 41 | UpdateWindow(PlatformData->Window);
|
---|
| 42 |
|
---|
| 43 | ShowCursor(FALSE);
|
---|
[326] | 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 |
|
---|
[323] | 49 | return 0;
|
---|
| 50 | }
|
---|