source: Daodan/src/Daodan_Win32.c@ 467

Last change on this file since 467 was 326, checked in by rossy, 15 years ago

This is the first "non-working" commit of Daodan. For this reason, the last fully working release is in the /release/ folder while the current build is in the /build/ folder. The reason it's not working is that I'm trying to write a "proper" windowed mode by replacing ONrPlatform_Initialize and gl_platform_initialize. I'm currently in the middle of rewriting gl_platform_initialize and Oni's draw engine doesn't like the new code.

File size: 1.6 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"
9
10short 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, FALSE);
38
39 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);
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}
Note: See TracBrowser for help on using the repository browser.