Ignore:
Timestamp:
May 17, 2009, 2:19:35 PM (14 years ago)
Author:
rossy
Message:

DDrPlatform_Initialize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/Daodan_Win32.c

    r322 r323  
     1#include <windows.h>
     2
     3#include "Daodan.h"
     4#include "Daodan_Win32.h"
     5
     6#include "Oni.h"
     7
     8short ONICALL DDrPlatform_Initialize(ONtPlatformData *PlatformData)
     9{
     10        WNDCLASSEX WndClass;
     11        RECT Rect;
     12        const int Width = 640, Height = 480;
     13
     14        PlatformData->Instance = g_Instance;
     15
     16        WndClass.cbSize = sizeof(WndClass);
     17        WndClass.style = WS_OVERLAPPED | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
     18        WndClass.cbClsExtra = 0;
     19        WndClass.cbWndExtra = 0;
     20        WndClass.hInstance = PlatformData->Instance;
     21        WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
     22        WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
     23        WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
     24        WndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
     25        WndClass.lpszMenuName = NULL;
     26        WndClass.lpszClassName = "ONI ";
     27        WndClass.lpfnWndProc = ONrPlatform_WindowProc;
     28
     29        RegisterClassEx(&WndClass);
     30       
     31        Rect.left = (GetSystemMetrics(SM_CXSCREEN) / 2) - (Width / 2);
     32        Rect.top = (GetSystemMetrics(SM_CYSCREEN) / 2) - (Height / 2);
     33        Rect.right = Rect.left + Width;
     34        Rect.bottom = Rect.top + Height;
     35        AdjustWindowRect(&Rect, WndClass.style, FALSE);
     36
     37        PlatformData->Window = CreateWindowEx(0, "ONI ", "ONI ", WS_POPUP, Rect.left, Rect.top, Rect.right - Rect.left, Rect.bottom - Rect.top, NULL, NULL, PlatformData->Instance, NULL);
     38        ShowWindow(PlatformData->Window, SW_SHOWNORMAL);
     39        UpdateWindow(PlatformData->Window);
     40
     41        ShowCursor(FALSE);
     42
     43        return 0;
     44}
Note: See TracChangeset for help on using the changeset viewer.