[fpc-devel] Microsoft Game API header translation for Windows CE

Nikolay Nikolov nickysn at users.sourceforge.net
Sat Mar 10 11:46:07 CET 2007


For more information about GAPI:
http://msdn2.microsoft.com/en-us/library/aa459123.aspx

You may add this unit to the fpc wince rtl, if you want.
-------------- next part --------------
Unit gx;

{$MODE objfpc}

{ convention is cdecl for WinCE API}
{$calling cdecl}

Interface

Uses
  Windows;

Const
  GXDLL =3D 'gx';

Type
  GXDisplayProperties =3D Record
    cxWidth : DWord;
    cyHeight : DWord;            // notice lack of 'th' in the word height.
    cbxPitch : LONG;             // number of bytes to move right one x pix=
el - can be negative.
    cbyPitch : LONG;             // number of bytes to move down one y pixe=
l - can be negative.
    cBPP : LONG;                 // # of bits in each pixel
    ffFormat : DWord;            // format flags.
  End;

  GXKeyList =3D Record
    vkUp : SHORT;             // key for up
    ptUp : POINT;             // x,y position of key/button.  Not on screen=
 but in screen coordinates.
    vkDown : SHORT;
    ptDown : POINT;
    vkLeft : SHORT;
    ptLeft : POINT;
    vkRight : SHORT;
    ptRight : POINT;
    vkA : SHORT;
    ptA : POINT;
    vkB : SHORT;
    ptB : POINT;
    vkC : SHORT;
    ptC : POINT;
    vkStart : SHORT;
    ptStart : POINT;
  End;

Function GXOpenDisplay(AhWnd : HWND; dwFlags : DWORD) : Integer; External G=
XDLL Name '?GXOpenDisplay@@YAHPAUHWND__@@K at Z';
Function GXCloseDisplay : Integer; External GXDLL Name '?GXCloseDisplay@@YA=
HXZ';
Function GXBeginDraw : Pointer; External GXDLL Name '?GXBeginDraw@@YAPAXXZ';
Function GXEndDraw : Integer; External GXDLL Name '?GXEndDraw@@YAHXZ';
Function GXOpenInput : Integer; External GXDLL Name '?GXOpenInput@@YAHXZ';
Function GXCloseInput : Integer; External GXDLL Name '?GXCloseInput@@YAHXZ';
Function GXGetDisplayProperties : GXDisplayProperties; External GXDLL Name =
'?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ';
Function GXGetDefaultKeys(iOptions : Integer) : GXKeyList; External GXDLL N=
ame '?GXGetDefaultKeys@@YA?AUGXKeyList@@H at Z';
Function GXSuspend : Integer; External GXDLL Name '?GXSuspend@@YAHXZ';
Function GXResume : Integer; External GXDLL Name '?GXResume@@YAHXZ';
Function GXSetViewport(dwTop, dwHeight, dwReserved1, dwReserved2 : DWORD) :=
 Integer; External GXDLL Name '?GXSetViewport@@YAHKKKK at Z';
Function GXIsDisplayDRAMBuffer : BOOL; External GXDLL Name '?GXIsDisplayDRA=
MBuffer@@YAHXZ';


// Although these flags can be unrelated they still
// have unique values.

Const
  GX_FULLSCREEN    =3D $01;        // for OpenDisplay()
  GX_NORMALKEYS    =3D $02;
  GX_LANDSCAPEKEYS =3D $03;

  kfLandscape      =3D $8;        // Screen is rotated 270 degrees
  kfPalette        =3D $10;       // Pixel values are indexes into a palette
  kfDirect         =3D $20;       // Pixel values contain actual level info=
rmation
  kfDirect555      =3D $40;       // 5 bits each for red, green and blue va=
lues in a pixel.
  kfDirect565      =3D $80;       // 5 red bits, 6 green bits and 5 blue bi=
ts per pixel
  kfDirect888      =3D $100;      // 8 bits each for red, green and blue va=
lues in a pixel.
  kfDirect444      =3D $200;      // 4 red, 4 green, 4 blue
  kfDirectInverted =3D $400;

  GETRAWFRAMEBUFFER =3D $00020001;

Type
  RawFrameBufferInfo =3D Record
    wFormat : WORD;
    wBPP : WORD;
    pFramePointer : Pointer;
    cxStride : Integer;
    cyStride : Integer;
    cxPixels : Integer;
    cyPixels : Integer;
  End;

Const
  FORMAT_565   =3D 1;
  FORMAT_555   =3D 2;
  FORMAT_OTHER =3D 3;

Implementation

End.


More information about the fpc-devel mailing list