Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Latest Delphi for .NET managed DirectX 9 Demos.

  1. #1

    Latest Delphi for .NET managed DirectX 9 Demos.

    Ported C# DirectX 9 Managed Examples to Delphi for .NET can be
    downloaded from....
    http://codecentral.borland.com/codec...sting?id=21147

    Now includes the Text3D demo from the SDK and 2 new Demos not from the
    SDK. Which are an X-File Viewer that show's animations if they exist, A
    D3DSprite Animation Demo. Both include classes that you should be able
    to use in your own demos/games. These are not perfect, but should
    hopefully get you started.

    The PointSprites demos still causes an AV at funtime when
    VertexBuffer.Create is called. I believe this to be a compiler issue.
    Any help in tracking down this bug would be appreciated.

    There are now 33 Examples, which are...
    AudioVideo : 2
    Texture
    Player

    Direct3D : 16
    AnimatedSprites
    Billboard
    DolphinVS
    Fractal
    Lighting
    Meshes : 2
    ProgressiveMesh
    XFileViewer
    PointSprites
    StencilBuffer : 1
    ShadowVolume
    Text3D
    Tutorials : 6

    DirectDraw : 1

    DirectInput : 4
    Joystick
    Keyboard
    Mouse
    Scrawl

    DirectPlay : 7
    Tutorials
    Tut01_GetServiceProviders
    Tut02_Host
    Tut03_FindHosts
    Tut04_Connect
    Tut05_Send
    Tut06_HostMigration
    Tut07_LobbyLaunch

    DirectSound : 3
    EnumSoundDevices
    Play3DSound
    SoundFX


    If you have any other Delphi.NET managed DirectX 9 demo that you would
    like included in this archive, just let me know.


    Dominique
    http://www.DelphiGamer.com := go on, write a game instead;
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #2

    Latest Delphi for .NET managed DirectX 9 Demos.

    are there any win32 delphi examples? i dont even have directplay in my directx9 sdk :?


    mainly im looking at how to create a connection and send some data, is it right to use IDirectPlay8Peer ? i cant find out how to create the instance, i found i should use CoCreateInstance but i cant find the unit the procedure is in

  3. #3

    Latest Delphi for .NET managed DirectX 9 Demos.

    Pure Win32 DirectX 9 examples that have been ported to Delphi can always be found @ http://clootie.narod.ru/ and downloaded from http://sourceforge.net/projects/delphi-dx9sdk/.

    Unfortunately, I think most of them are Direct3D ports and not DirectPlay, but check just in case.

    If I have time over christmas I may port some, I remember doing some DirectPlay demos back in the days when I thought DirectXPress would be a good idea, but I can't seem to find them on my HD, so a new port is probably best.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #4

    Latest Delphi for .NET managed DirectX 9 Demos.

    ive looked on clootie's site and its d3d/ddraw and a few dsound

    much aprieciated if you manage to find them but theres no rush

  5. #5

    Latest Delphi for .NET managed DirectX 9 Demos.

    ive got the peer working but it wont enum the service providers.

    i found this on msdn http://msdn.microsoft.com/archive/de...numeratesp.asp

    and came up with this

    [pascal] Peer: IDirectPlay8Peer;


    function DirectPlayMessageHandler(pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;

    implementation

    {$R *.dfm}

    function DirectPlayMessageHandler(pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT;
    Begin
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    var
    pdnSPInfo: PDPN_SERVICE_PROVIDER_INFO;
    pdnSPInfoEnum: PDPN_SERVICE_PROVIDER_INFO;
    dwItems: DWord;
    dwSize: DWord;
    i: DWord;

    strBuf: PAnsiChar;

    begin
    pdnSPInfo := nil;
    pdnSPInfoEnum := nil;
    dwItems := 0;
    dwSize := 0;
    i := 0;
    strBuf := nil;


    CoCreateInstance(CLSID_DirectPlay8Peer, nil, CLSCTX_INPROC_SERVER, IID_IDirectPlay8Peer, peer);
    Peer.Initialize(nil, @DirectPlayMessageHandler, 0);

    //Determine the required buffer size
    Peer.EnumServiceProviders(nil, nil, nil, dwSize, dwItems, 0);

    //pdnSPInfo = (DPN_SERVICE_PROVIDER_INFO*) new BYTE[dwSize]; ??

    //Fill the buffer with service provider information
    Peer.EnumServiceProviders(nil, nil, pdnSPInfo, dwSize, dwItems, 0);

    // Print the provider descriptions
    pdnSPInfoEnum := pdnSPInfo;

    for i:=0 to dwItems {-1} do
    Begin
    try
    DXUtil_ConvertAnsiStringToGenericCch(strBuf, @pdnSPInfoEnum.pwszName, 256);
    ListBox1.Items.Add(strBuf);
    Inc(pdnSPInfoEnum);
    except
    Break;
    end;
    end;
    end;

    procedure TForm1.FormDestroy(Sender: TObject);
    begin
    Peer.Close(0);
    Peer._Release;
    end;[/pascal]

    but it doesnt work also causes access violations on closing the app

  6. #6

    Latest Delphi for .NET managed DirectX 9 Demos.

    Hi Tux,
    Ok you twisted my arm


    the following works for me without any AVs...
    [pascal]
    procedure TForm1.FormCreate( Sender : TObject );
    var
    pdnSPInfo : PDPN_SERVICE_PROVIDER_INFO;
    pdnSPInfoEnum : PDPN_SERVICE_PROVIDER_INFO;
    dwItems : DWord;
    dwSize : DWord;
    i : DWord;
    strBuf : WideString;
    hr : Cardinal;
    begin
    dwItems := 0;
    dwSize := 0;

    hr := CoCreateInstance( CLSID_DirectPlay8Peer, nil,
    CLSCTX_INPROC_SERVER,
    IID_IDirectPlay8Peer,
    peer );
    if hr = S_OK then
    begin
    hr := Peer.Initialize( nil, @DirectPlayMessageHandler, 0 );

    if hr = S_OK then
    begin
    //Determine the required buffer size
    Peer.EnumServiceProviders( nil, nil, nil, dwSize, dwItems, 0 );

    GetMem( pdnSPInfo, dwSize );
    try
    //Fill the buffer with service provider information
    Peer.EnumServiceProviders( nil, nil, pdnSPInfo, dwSize, dwItems, 0 );

    // Print the provider descriptions
    pdnSPInfoEnum := pdnSPInfo;

    for i := 0 to dwItems - 1 do
    begin
    strBuf := WideString( pdnSPInfoEnum.pwszName );

    ListBox1.Items.Add( strBuf );
    Inc( pdnSPInfoEnum );
    end;
    finally
    FreeMem( pdnSPInfo );
    end;
    end;
    end;
    if hr <> S_OK then
    ShowMessage( DXErrorString( hr ) );
    end;

    procedure TForm1.FormDestroy( Sender : TObject );
    begin
    Peer.Close( 0 );
    Peer := nil;
    end;
    [/pascal]

    Delphi shields you from a lot of COM's nastiness so setting Peer to nil should be all that is necessary ( in this case ) for it to decrement the reference count and free the appropriate COM interface memory.

    Also I would suggest checking the return values from most DirectX calls just to make sure your system is set up correctly, or that there is something else causing the error.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  7. #7

    Latest Delphi for .NET managed DirectX 9 Demos.

    *bowes down to savage*

    works great thanks a lot

  8. #8

    Latest Delphi for .NET managed DirectX 9 Demos.

    Well if you port/create any DirectPlay demos in Pascal, let me or Clootie know, so I they can be added to the other Win32 demos as part of the http://sourceforge.net/projects/delphi-dx9sdk/ project.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  9. #9

    Latest Delphi for .NET managed DirectX 9 Demos.

    do you know where to get the full c demos? there not included in the dx9 summer sdk

  10. #10

    Latest Delphi for .NET managed DirectX 9 Demos.

    You will have to check with clootie.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •