DirectX 8 Help

  • Thread starter Thread starter kakarot
  • Start date Start date
K

kakarot

I'm new to VB.net and DirectX, so I'm following a tutorial in a book
that is apparently written in VS6. I'm using the the VB Express 2005.
The problem lies using the CopyRects function. In the book, the
function calls for a RECT variable. The CopyRects function now calls
for a IntPtr variable where the RECT was in the book. The same goes
for a POINT variable later in the function. Here is a snipet of the
code:

Dim sourceRect As DxVBLibA.RECT

'Setup RECT
sourceRect.left = sourcex
sourceRect.top = sourcey
sourceRect.right = sourcex + width
sourceRect.bottom = sourcey + height

'Create POINT
Dim point1 As DxVBLibA.POINT

'Setup POINT
point1.x = destx
point1.y = desty

'Draw Tile
d3ddev.CopyRects(source, sourceRect, 1, backBuffer, point1)

d3ddev is of dxvbliba.direct3ddevice8. What the function is calling
for is a IntPtr in place where the sourceRect and point1 is located.
If anyone has any clue, please help.

Thanks in advance,
Klaki
 
I'm new to VB.net and DirectX, so I'm following a tutorial in a book
that is apparently written in VS6. I'm using the the VB Express 2005.

Is there a pressing reason why you can't use DX 9, which has managed
(ie .net-friendly) libraries? Targeting the DX8 libraries from VB.NET
means you have effectively *two* transitions to make: from .net to
unmanaged, and from VB to C++-oriented.
The problem lies using the CopyRects function. In the book, the
function calls for a RECT variable. The CopyRects function now calls
for a IntPtr variable where the RECT was in the book. The same goes
for a POINT variable later in the function. Here is a snipet of the
code:

Dim sourceRect As DxVBLibA.RECT

'Setup RECT
sourceRect.left = sourcex
sourceRect.top = sourcey
sourceRect.right = sourcex + width
sourceRect.bottom = sourcey + height

'Create POINT
Dim point1 As DxVBLibA.POINT

'Setup POINT
point1.x = destx
point1.y = desty

'Draw Tile
d3ddev.CopyRects(source, sourceRect, 1, backBuffer, point1)

d3ddev is of dxvbliba.direct3ddevice8. What the function is calling
for is a IntPtr in place where the sourceRect and point1 is located.
If anyone has any clue, please help.

How is CopyRects being declared? In a type library, or by a Declare? I
don't have the DX docs to hand, but I see from the WinCE DX stuff that
the CopyRects function there expects an array of RECT and an array of
POINT - which of course C-style is passed as a pointer to a RECT and a
pointer to a POINT, which I suppose might get translated as IntPtrs.
Really you want a declaration of CopyRects that understands this. But
see my first comment as I'm already out of my depth.
 
i don't have any declare statements so I guess it's in the DxVBLibA
library. Here is how it's declared according to the Definition:

Sub CopyRects(ByVal SourceSurface As DxVBLibA.Direct3DSurface8, ByVal
FirstElementOfSourceRectsArray As System.IntPtr, ByVal NumberOfRects As
Integer, ByVal DestinationSurface As DxVBLibA.Direct3DSurface8, ByVal
FirstElementofDestPointArray As System.IntPtr)
Member of: DxVBLibA.Direct3DDevice8
 
Back
Top