#include #include "Daodan.h" #include "Daodan_Win32.h" #include "BFW_Utility.h" #include "Oni.h" short ONICALL DDrPlatform_Initialize(ONtPlatformData *PlatformData) { WNDCLASSEX WndClass; RECT Rect; const int Width = 640, Height = 480; PlatformData->Instance = g_Instance; WndClass.cbSize = sizeof(WndClass); WndClass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hInstance = PlatformData->Instance; WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); WndClass.hbrBackground = GetStockObject(BLACK_BRUSH); WndClass.lpszMenuName = NULL; WndClass.lpszClassName = "ONI "; WndClass.lpfnWndProc = ONrPlatform_WindowProc; RegisterClassEx(&WndClass); Rect.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (Width / 2); Rect.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (Height / 2); Rect.right = Rect.left + Width; Rect.bottom = Rect.top + Height; AdjustWindowRect(&Rect, WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP, FALSE); PlatformData->Window = CreateWindowEx(0, "ONI ", "ONI ", WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_POPUP, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, NULL, PlatformData->Instance, NULL); ShowWindow(PlatformData->Window, SW_SHOWNORMAL); UpdateWindow(PlatformData->Window); ShowCursor(FALSE); // I dont know why this is needed but Oni doesn't init without it. ONgPlatformData.Window = PlatformData->Window; //ONgPlatformData.Instance = PlatformData->Instance; return 0; }