PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GapiDraw Book

Hi everyone, my name is G.R.Moore from PocketPC Studios. Some of you may already know me from my postings on this forum and the GapiDraw tutorials on the ppcstudios website.

I've begun working on a book covering game development on pocket pc devices using GapiDraw. I have a working table of contents for the book, but I would like to hear from you, the developers, what topics should be covered.

GapiDraw is easily the most popular toolkit for pocket pc game development, and it deserves a text that explains the basics as well as advanced topics in a clear and easy to understand manner. With your input and support, I think I can provide just such a book.

-- GR
InexorableTash · 16 Jan 2003, 08:57 UTC — Sound!
There is at least one other book on game writing for the PocketPC platform; it touches on raw GAPI and outlines sprite classes. For sound it introduces the basic PlaySound API and hints "perhaps you should write a mixer". Well, duh, that's not going to help the audience that needs a book!

Including documentation and examples on a licensable or free sound mixer such as FMOD would be a good compliment to GapiDraw. If Johan can get GapiSound off the drawing board, or if eFortier wants to share his mixer, (etc) it would be a great way to round out the book.

You might also want to solicit articles or case-studies from companies producing PPC games, much like the Graphics Gems and Game Programming Gems series. These appeal to the high-end developer.

As far as suggestions towards the book - think very carefully about the target audience. Is it going to be introductory or VB developers who will need to learn C++ while they're learning GapiDraw, and thus need a more gentle introduction? This forum seems to get many questions from developers at that level, so it would increase your target audience, at the risk of diluting the content. If you're aiming at experienced C++ developers, what is the value your book will provide over the online documentation and sample code?

Good luck - I look forward to seeing the results!
I would kill to be able and rip my mixer out and replace it with another one. I'm just to cheap to license FMOD.
InexorableTash wrote:or if eFortier wants to share his mixer


I would, believe me. But I would like to provide it in DLL form, and there lies the problem.

My mixer use classes. And since it includes support for playing vorbis files and mods, the header file contains references to those libraries as well as some of my own classes to manage lists, other templates, etc.

I tried to create a "trimmed down" include file without all the dependencies, but the functions names would get different tags and would not link.

I would hate having to change the internal working of the mixer to use normal API calls, and manage classes internally.

Does anyone have experience with this?

Thanks, and sorry for the Out-Of-Topic post.

--Eric
InexorableTash · 17 Jan 2003, 17:43 UTC — Hiding implementation
There are several design patterns for this:

- Export only an interface

This is what Microsoft's COM does. The header file for your DLL contains only abstract base classes (interfaces) such as ISoundMixer, ISoundBuffer, etc. and a factory for creating them in a function, such as CreateSoundMixer().

This is the pattern I tend to follow since I "grew up" with it. I also use IUnknown-style refcounting since smart pointers and a good leak tracker (VC provides this free) make it transparent and easy once you have the religion.

Down side - all of your objects are referenced with pointers. This clashes with GapiDraw's simpler style. You also can't allocate on the stack.

- Get a PIMPL

This design pattern - short for Private IMPLemenetation, defines a public class definition like this in the .H you distribute:

CSoundBuffer
{
public:
// constructor, methods, etc, but no storage or anything private
private:
void* _pimpl;
}

You have a private definition for the same class when you are building the DLL which is mostly identical but has one small change:

CSoundBuffer
{
public:
// constructor, methods, etc, but no storage or anything private
private:
CSoundBufferImpl* _pimpl;
}

The constructor creates a CSoundBufferImpl and saves the pointer in _pimpl. The destructor destroys it. All of your other methods (e.g. LoadWave) simply call the real implementation on the implementation class (e.g. _pimpl->LoadWave() ).

The user will just see a normal class they can instantiate with x = new CBlahBlah() or even CBlahBlah x() for stack allocations. (If you don't know about stack allocations in C++ you're really missing out!)

Down side: Maintaining two real class implementations plus two headers is heavier weight than just maintaining an interface plus a class definition plus an implementation.

...

There are other design patterns, and a lot of references on the web about them. Google search on "hiding implementation" and "design pattern".

Note that in either of these design patterns you're going to suffer a speed hit calling the methods - in the interface method you're hitting a VTable, and in the PIMPL method there's the un-optimizable second call. So you shouldn't expect callers to use these in tight loops -- but you shouldn't be making function calls in tight loops anyway. This is one reason you have Lock()-type methods that give a caller all the data they need to do the work without calling any other methods.
I believe I will use the PIMPL, as this will allow users to use classes more easily.

Thanks for taking the time to explain these concepts. I appreciate it alot.

--Eric