The window commands I include with PureGDK provide a way to accessing the message queue in your own loop. The convetional way of handing window messages can be difficult to grasp and doesn't give you the single-message granularity that my method does.
For example, conventionally in Win32 you would do all of this.
Create the window with lots of WIn32 black magic. Is it centered, what brush is used for the window color, does it have a cursor, does it have an icon, what is its instance, what are its border styles, what is its size (as a rect), class name, etc, etc:
RECT rect;
HWND hWnd;
HINSTANCE hInstance = GetModuleHandle(0);
const char* className = "wndclass";
Wnd.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
Wnd.lpfnWndProc = (WNDPROC)_PdkWindow_DefWndCallback;
Wnd.cbClsExtra = 0;
Wnd.cbWndExtra = 0;
Wnd.hInstance = hInstance;
Wnd.hIcon = LoadIcon(NULL, IDI_WINLOGO);
Wnd.hCursor = LoadCursor(NULL, IDC_ARROW);
Wnd.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
Wnd.lpszMenuName = 0;
Wnd.lpszClassName = className;
RegisterClass(&Wnd);
SetRect(&rect, 0, 0, width, height);
AdjustWindowRectEx(&rect, style, 0, WS_EX_WINDOWEDGE);
if (centered) {
x = GetSystemMetrics(SM_CXSCREEN)/2 - (rect.right - rect.left)/2;
y = GetSystemMetrics(SM_CYSCREEN)/2 - (rect.bottom - rect.top)/2;
}
hWnd = CreateWindowEx(WS_EX_WINDOWEDGE, className, title.c_str(), style, x,
y, rect.right - rect.left, rect.bottom - rect.top, 0, 0, hInstance, 0);
if (!hWnd)
return 0;
// Paint window
UpdateWindow(hWnd);
http://msdn.microsoft.com/en-us/library/ms632679(v=vs.85).aspx
Then at some point in your main application loop you have to handle the message queue. This is the conventional way to do it but you end up looping over more messages than you might like to at any given time. Too many messages or too much processing might lag your application, and if you want to "skip" some then you have to add in a lot more code to handle those types of events:
MSG msg;
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
http://en.wikipedia.org/wiki/Message_loop_in_Microsoft_Windows
The method I provide in simpleWindow.h wraps all of that up into a few very simple functions for creating a window and pumping the message queue with single-message granularity. Additionally, it prioritizes some messages such as WM_CLOSE and WM_QUIT to the front of the queue, ignoring all other messages if the user intents to quit the application.
More information on the different types of window messages can be found here:
http://msdn.microsoft.com/en-us/library/ms632590(VS.85).aspxp
http://msdn.microsoft.com/en-us/library/ms644927(v=VS.85).aspx#system_defined
Here is a list of specific window messages:
http://msdn.microsoft.com/en-us/library/ff468922(v=VS.85).aspx
Both DarkGDK and PureGDK hide all of this from you. The difference however, is that PureGDK still gives you access to all of these system calls so you can change it as much as you like.
Many different application frameworks for Windows wrap up the message queue. For example, you can utilize the power of Qt with PureGDK. In contrast, DarkGDK does not give you access to its implementation and would therefore be incompatible:
http://en.wikipedia.org/wiki/Qt_(framework)
Quote: "The only thing that bothered me is the size of the engine.dll. A packed DarkGDK exe is only 400k big and has no dependency on any DLLs."
A small price to way, I think. One overwhelming advantage is that through dynamic linking, PureGDK is compatible with almost any C++ compiler (not just VC++ 2008 and 2010 with DarkGDK). PureGDK will "just work" with any standards-compliant C++ compiler such as any version of Visual Studio, g++, Borland, Watcom, Intel, Comeau, etc.
PureGDK will be compatible with any future version of Visual Studio (2012, etc) on day 1.
Although it isn't documented yet, the PureGDK tool 'gdkc.exe' has quite a few options to be configured when building the engine:
Compile DarkBasic Professional engine and plugins to a DLL.
Usage: gdkc [options]
Options:
--help Display this information.
-i <dll[,..]> Include the specified libraries and resolve any additional
dependencies automatically.
-e <dll[,..]> Exclude the specified libraries from the dependency solution.
-donotresolve Do not resolve library dependencies.
-nocore Do not automatically include core libraries.
-all Attempt to compile the engine and all known plugins.
-o <file/path> Specifies the output location and/or name of the file. The
default is gdkengine.dll
-l <level> Specify the compressional level. The amount of compression
can be specified as any integer 0 <= level <= 9. The default
compression is '1'.
-q Do not show compiled dependency list.