Quote: "I currently don't own PureGDK, DB Pro, or PureBasic. To develop using PureGDK C++, do I need to own all three of those?"
DarkBasic Professional is required only during installation (the necessary files are copied), however it is compatible with the free version:
http://www.thegamecreators.com/?id=2000&m=view_product&page=free
Just make sure you upgrade it to the version which is compatible with PureGDK. Currently this is the 7.7 RC. Previous releases will not work.
PureGDK 1.0 was PureBasic-only. PureGDK 2.0 provides PureBasic and C++ headers but the SDK provides the source code for adding support for whatever language you want:
http://forum.thegamecreators.com/?m=forum_view&t=186644&b=38
Quote: "Is it easy to convert from DarkGDK C++ to PureGDK C++ (is there a tutorial anywhere)?"
There have been a lot of changes in PureGDK. Fortunately, you won't have to wait long for the documentation which will be release soon in the next beta. If you've ever read the DBP or DarkGDK documentation, I'm sure you'll LOVE what's in store for PureGDK!
Here is a look at the layout of a function in the new documentation being built for the next beta.
The documentation will come in the excellent .chm format with an index and full text search.
All source code and templates for the documentation builder will be available in the SDK for you to help extend the existing docs and also for you to apply to your own projects if you like.
The documentation for C++:
Many of the commands have been renamed for clarity and others have had their parameters reordered to support default parameters and function polymorphism.
Here is an example of a function which will have its parameters reordered for the next beta (beta 7!), which brings support for automatic ID allocation:
Quote: "
Result = dbLoadSound(string fileName[, int soundID])"
The "soundID" parameter is optional and therefore appears at the end of the function. If no ID is specified, one will be returned as the result.
For functions which take advantage of default parameters, the header might look like this:
Quote: "
dbLoadSound(string fileName, int soundID = -1)"
And for others which use function polymorphism, for example:
Quote: "
dbLoadSound(string fileName)
dbLoadSound(string fileName, int soundID)"
Another example where a command might be different is "dbSetDisplayMode".
In DarkGDK you can use these commands to change the resolution:
Quote: "
void dbSetDisplayMode (int iWidth, int iHeight, int iDepth)
bool dbSetDisplayModeEx(int iWidth, int iHeight)
bool dbSetDisplayModeEx(int iWidth, int iHeight, int iDepth)
bool dbSetDisplayModeEx(int iWidth, int iHeight, int iDepth, int iMode)
bool dbSetDisplayModeEx(int iWidth, int iHeight, int iDepth, int iMode, int iVertexProcessing)
bool dbSetDisplayModeEx(int iWidth, int iHeight, int iDepth, int iMode, int iVertexProcessing, int iLockable)
bool dbSetDisplayModeVSync(int iWidth, int iHeight, int iDepth, int iVSyncOn)
bool dbSetDisplayModeAntialias (int iWidth, int iHeight, int iDepth, int iVSyncOn, int iMultisamplingFactor, int iMultimonitorMode)"
In PureGDK the same command with optional parameters is:
Quote: "
dbSetDisplayMode(int width, int height[, int depth[, int vSync[, int multiSampling[, int multiMonitor[, int backBufferWidth[, int backBufferHeight[, int vrMode]]]]]]])"
In this function each parameter after width and height can be optionally specified.
PureGDK has built-in support for multithreading by providing function-level critical sections for your convenience behind the scenes as well as thread-aware error handling. Each function can have several possible error codes which can be detected are caught at runtime for you to examine and respond to.
For example, dbMakeMatrix() can throw any of the following errors for you to catch with dbGetLastError():
Quote: "
RUNTIMEERROR_B3DMATRIXNUMBERILLEGAL
RUNTIMEERROR_B3DMATRIXALREADYEXISTS
RUNTIMEERROR_B3DMATRIXSEGMENTWRONG
RUNTIMEERROR_B3DMATRIXDIMENSIONWRONG
RUNTIMEERROR_B3DMATRIXTOOLARGE"
dbGetLastError() will return the last error to occur in the current thread. It can safely and accurately be used accross multiple threads.
It's also important to understand that PureGDK, unlike DarkGDK, uses a customizable DLL engine based on the DarkBasic Professional plugin system. Everything is dynamically linked NOT statically linked by DarkGDK. See the example projects provided by the installer as well as here for additional information:
http://forum.thegamecreators.com/?m=forum_view&t=179245&b=22&msg=2200672#m2200672
The advantage to this is that it is compatible with ALL standards compliant C++ compilers. You can use any version of Visual Studio, g++, Borland, Watcom, Intel, Comeau, etc.
You can even use Visual C++ 6 if you really want to-- example projects are provided!
One major difference you must be aware of is that PureGDK does NOT use "DarkGDK()/LoopGDK()". It can use whatever entry point you want, be it main(), WinMain(), _tWinMain(), etc:
#include <puregdk.h>
#include <initPureGDK.h>
#include <simpleWindow.h>
int __stdcall WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
HWND hWnd;
If (!initPureGDK("gdkengine.dll"))
Return 1;
hWnd = OpenWindow(0, 0, 640, 480, "DarkBasic Professional - PureGDK",
WS_OVERLAPPED | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU |
WS_CLIPCHILDREN, true);
dbOpenScreen(hWnd, 0, 0, 640, 480);
ShowWindow(hWnd, SW_SHOW);
// Set the current directory
SetCurrentDirectory("media1");
..
Return 0;
}
Additionally, unlike DBP and DarkGDK, in PureGDK the renderable area is separate from the actual window. As you can see from this example code, dbOpenScreen accepts a target window handle "hWnd" which tells it where to render the output. This allows PureGDK to render to "any" window owned by the process and is not limited to any one implementation.
For example, you can use PureGDK with GLUT, Qt, Win32, wxWidgets, etc.
There are a lot of changes compared to DBP/DarkGDK. It is not targeted as being 1:1 compatible with DarkGDK and there will be growing pains while you encounter the differences. However, the idea behind PureGDK is to bring evolution to the engine to streamline it and in the end make it easier to use as well as being portable to other languages.
Don't forget! PureGDK is also compatible with all DarkBasic Professional plugins and includes many headers to provide support out-of-the-box. An SDK is also provided which allows anyone to add support for additional languages!!
PureGDK is designed such that whenever you decide to move to a different language, you can take the engine with you. You could say that compared to DarkGDK, that's even revolutionary!
At some point I hope to even provide a way of swapping the engine out for OpenGL to make the PureGDK cross-platform as well. :o
Never have to use a vector or matrix "ID" again! PureGDK supports vector and matrix datatypes as structures. This means that you can access any part of this data and they can be written to and read from memory:
// Declare variables with pre-defined structures
Vector2 Vector2a;
Vector2 Vector2b;
Vector2 Vector2Result;
// Set vector data
Vector2a.x = 3;
Vector2b.x = 7;
Vector2a.y = 5;
Vector2b.y = 5;
// Add vectors together
dbAddVector2(&Vector2Result, &Vector2a, &Vector2b);
// Output results
cout << Vector2Result.x << endl; // 3 + 7 = 10
cout << Vector2Result.y << endl; // 5 + 5 = 10
Quote: "Does PureGDK work in VS Express?"
C++ Projects supported by PureGDK out of the box:
GNU make/g++ (gcc compiling may require setup)
nmake/vc++ (vcvars32.bat compiling should work out of the box)
Visual Studio 6
Visual Studio .NET
Visual Studio .NET 2003
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
This list is not finite! PureGDK will "just work" with any standards-compliant C++ compiler. This includes any version of Visual Studio Express.