PureBasic Bindings for GameVision SDK 2

Developed or developing a new product in PureBasic? Tell the world about it.
BigDaddy
New User
New User
Posts: 6
Joined: Wed Nov 17, 2004 6:51 am

PureBasic Bindings for GameVision SDK 2

Post by BigDaddy »

Hello,

We made PB bindings for the GameVision SDK 2, a 2D rendering API for PC's running Microsoft Windows. This release is aimed specifically at Direct3D with 3D hardware. The GameVision SDK is feature complete and can easily create any type of 2D game with D3D for rendering. GameVision 1.x powered our game FreeStrike 1.x. GV was designed to be easy to use, robust and feature rich and should be easy to use in your projects.

You can download the beta PB bindings here: http://www.bigdaddygames.com/temp/gvsdk2_pb.zip (752KB) [PB 3.9x]

We hope to have official PB bindings plus examples in the next GVSDK2 update.

Visit the Big Daddy Games web site for more information about GVSDK2.


Best Regards,

Jarrod Davis
CEO/Lead Developer
Big Daddy Games, Inc.
support@bigdaddygames.com
www.bigdaddygames.com
BigDaddy
New User
New User
Posts: 6
Joined: Wed Nov 17, 2004 6:51 am

Post by BigDaddy »

How can I represent this type of structure in PB?

Code: Select all

/* GV_Vector - C/C++*/
typedef struct GV_Vector {
  union {
   struct { int iX,  iY,  iZ; };
   struct { unsigned int cX,  cY,  cZ; };
   struct { float sX,  sY,  sZ; };
   struct { double dX,  dY,  dZ; };
  };
} GV_Vector, *GV_pVector;
Thanks.

Jarrod
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

I don't know how C++ structures work.
However if you want all four included structures to share the same space (offset zero for each) then:

Code: Select all

Structure one
  iX.l
  iY.l
  iZ.l
Endstructure

Structure two
  cX.l
  cY.l
  cZ.l
Endstructure

Structure three
  sX.f
  sY.f
  sZ.f
Endstructure

Structure four
  dX.f
  dY.f
  dZ.f
Endstructure

; GV_Vector - C/C++
Structure GV_Vector
  StructureUnion {
    sA.one
    sB.two
    sC.three
    sD.four
  EndStructureUnion
EndStructure

If not (they are to be contiguous, which I assume) then

Code: Select all

; GV_Vector - C/C++
Structure GV_Vector
    sA.one
    sB.two
    sC.three
    sD.four
EndStructure
Above assumes int is long (4 bytes) and float is single precision (4 bytes). If double is an eight byte float then there is a problem as PB limits itself to 4 byte floats. I don't know of a way to get an unsigned long integer in PB. To get an unsigned word (2 byte) access using

var =GV_Vector\SB\cX & $FFFF

Finally, if I am off track or talking cr@p, someone smarter than I will come along and correct the above. :)

PS: I typed that in directly, it is not cut and paste so may have typos or other errors.
@}--`--,-- A rose by any other name ..
BigDaddy
New User
New User
Posts: 6
Joined: Wed Nov 17, 2004 6:51 am

Post by BigDaddy »

Coolness.

Thanks

Jarrod
BigDaddy
New User
New User
Posts: 6
Joined: Wed Nov 17, 2004 6:51 am

Post by BigDaddy »

Hi,

In GVSDK2, all exported routines use the STDCALL calling convention including all callback types. For example, I am currently working on making PB bindings for our ScriptVision SDK 2 (complete scripting using a modified version of lua wrapped in an easy to use API) and it defines a few callbacks that are needed for the advanced features such as debugging and error handling.

Can PB call a callback routine that uses the STDCALL calling convention?

Thanks

Jarrod
WolfgangS
Enthusiast
Enthusiast
Posts: 174
Joined: Fri Apr 25, 2003 3:30 pm

Post by WolfgangS »

BigDaddy wrote: Can PB call a callback routine that uses the STDCALL calling convention?
Try CallFunction(). If it doesn't work try CallCFunction()

MFG
WolfgangS
WolfgangS' projects http://www.schliess.net
Quotation of the month:
<p3hicy>oder ich hol mir so eine geile aus asien
<p3hicy>die ständig poppen will
<p3hicy>'n brötchen pro tag reicht doch
<p3hicy>die essen eh' nich so viel
BigDaddy
New User
New User
Posts: 6
Joined: Wed Nov 17, 2004 6:51 am

Post by BigDaddy »

Hi,

The dll will call a routine that you have defined in PB. For example:

SV_SetErrorProc(@MyErrorProc);

The dll expects this routine to use STDCALL and will be called on an error in script.

Thanks

Jarrod
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

PB's Callfunction() command uses STDCALL, CallCFunction() uses CDECL convention.
Mark my words, when you least expect it, your uppance will come...
BigDaddy
New User
New User
Posts: 6
Joined: Wed Nov 17, 2004 6:51 am

Post by BigDaddy »

Hi,

Yes I understand, but what I am wondering however is that when I define a function in PB does it use STDCALL by default? Once I set the callback, the dll itself will call the routine automatically, which will expect it to be in STDCALL form.

In C/C++ or Delph I can do this:

// c/c++
void __stdcall MyErrorProc(void); // will use stdcall

// delphi
procedure MyErrorProc; stdcall; // will use stdcall

Then when I call SV_SetErrorProc(MyErrorProc) this will define a error callback that the dll will call automatically when it encounters an error. So, I guess what I am asking then is how do I declare a routine to use a specific calling convention in PB?
Megaborsti
User
User
Posts: 35
Joined: Sat Aug 16, 2003 4:52 pm
Location: Germany

Post by Megaborsti »

I think PB procedures use STDCALL by default, because PB´s CallFunction() uses STDCALL and you can call the PB procedures of your own code with CallFunction() without loading an external dll 8) . Think about it :wink:
I become better!!! :)
blueapples
User
User
Posts: 19
Joined: Mon Oct 03, 2005 10:00 am

Post by blueapples »

Does anyone have this file? The site is gone and I'm looking for a Lua library for Delphi and PB...
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Domain doesnt really exists, only provides search results for the domain and lots of spam and popups ....
White Eagle
Enthusiast
Enthusiast
Posts: 215
Joined: Sun Jan 04, 2004 3:38 am
Location: Maryland

Post by White Eagle »

Another game engine bites the dust :?
Post Reply