Changeset 323 for Daodan


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

DDrPlatform_Initialize

Location:
Daodan
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Daodan/build.bat

    r297 r323  
    1 gcc -O3 -s -Wall -shared -fomit-frame-pointer -o build\binkw32.dll src\Oni_Symbols.S src\Daodan.c src\Daodan_DLLStubs.c src\Daodan_Patch.c src\Daodan_Utility.c src\daodan_gl.c
     1gcc -O3 -s -Wall -shared -fomit-frame-pointer -o build\binkw32.dll src\Oni_Symbols.S src\Daodan.c src\Daodan_DLLStubs.c src\Daodan_Patch.c src\Daodan_Utility.c src\Daodan_Win32.c src\daodan_gl.c -lgdi32
  • Daodan/src/Daodan.c

    r322 r323  
    22#include "Daodan_Patch.h"
    33#include "Daodan_Utility.h"
     4#include "Daodan_Win32.h"
    45
    56#include "Oni.h"
     
    8283        DDrPatch_MakeJump(UUrMachineTime_Sixtieths, DDrMachineTime_Sixtieths);
    8384       
     85        // Windowed mode
     86        DDrPatch_MakeJump(ONrPlatform_Initialize, DDrPlatform_Initialize);
     87       
    8488        ONiMain(argc, argv);
    8589}
  • 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}
  • Daodan/src/Daodan_Win32.h

    r322 r323  
     1#pragma once
     2#ifndef DAODAN_WIN32_H
     3#define DAODAN_WIN32_H
     4
     5#include "Daodan.h"
     6#include "Oni.h"
     7
     8short ONICALL DDrPlatform_Initialize(ONtPlatformData *PlatformData);
     9
     10#endif
  • Daodan/src/Oni.h

    r322 r323  
    1111void __cdecl ONiMain(int ArgCount, char *ArgList[]);
    1212short ONICALL ONrPlatform_Initialize(ONtPlatformData *PlatformData);
     13LRESULT CALLBACK ONrPlatform_WindowProc(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam);
     14
     15extern HINSTANCE g_Instance;
    1316
    1417#endif
  • Daodan/src/Oni_Symbols.S

    r322 r323  
    1212// Oni Engine
    1313symbol ( _ONiMain                            , 0x000d3280 )
     14symbol ( @ONrPlatform_Initialize@4           , 0x0010f670 )
     15symbol ( _ONrPlatform_WindowProc@16          , 0x0010f7a0 )
     16
     17symbol ( _g_Instance                         , 0x0021f9e4 )
    1418
    1519// BFW_Utility
Note: See TracChangeset for help on using the changeset viewer.