PocketMatrix forums

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

eVC++ and GAPIDraw

Hi all,

Ok, I want to ask everyone a question and it's one that everyone must have at least been asked a few times...

You see, I'm very much into building games for PC's, but I've always used VB or BASIC like languages to build them. What I would like to do now, is to move to creating games for PocketPC as this market needs many more games written, but I'd like to do it using GAPIDraw. Now, I know what you're thinking. To do this, I'm going to have to use eVC++, and I have no problem with this. I know a good 15 or so languages, all be it most are high level, and I'm sure I could get into eVC++ quickly, but I need to know the best way into this. I already understand the concept of pointers, polymorphism, inheritance, blah blah blah, I just need a good solid book or something by my side that can tell me how to put it all together.

Does anyone have an answer?

I was thinking of buying a book on VC++ and them moving onto eVC++ from there, but is that the best option???

Thanks,
Mr.Prayer · 30 Sep 2002, 18:13 UTC — eVC++ and GAPIDraw
Lazarus wrote:
I was thinking of buying a book on VC++ and them moving onto eVC++ from there, but is that the best option???

I think "Pocket PC Game Programming: Using the Windows CE Game API" will be best choice.
Conan · 30 Sep 2002, 19:15 UTC — Books to buy ?
Most of the Visual C++ books spend too much time explaining the environment & using the visual elements when in fact what you really need to know about is how classes work and the syntax of functions.

I bought Programming Microsoft Windows CE by Douglas Boling and it's ok but again drells on regular Windows tuff too much which as a games developer you don't use much.

A word of caution. I set aside 3 months to learn C++ having come from a professional programming background including lots of game programming and it took me 15 months to get really comfortable with C++
See? This is what I was afraid of... This is the one reason I have taken so long to port over to C++!

You are right. I do only want to learn how to develop games in C++. If I wanted to create an app of some sort, I would write it in eVB, but obviously, with the state of programming tools and resources for the CE environment, it would be very difficult to develop anything professional using eVB, games wise, for CE.

I've been reading SAMS Teach Yourself Visual C++ in 24 Hours, with the idea that it would open up how to use classes, structures, header files, resources, API's etc. etc. within eVC++, but the whole application configuration and setup issue seems to baffle me immensely. Because C++ is so configurable, it might take me a year or so just to get that bit right!

Aaaaarrrrrgggghhhhh!

Does anyone rate Ivor Horton's WROX book 'Beginning Visual C++ 6'? I was thinking of getting it as he is known as THE C++ guru.

If so, then I may opt to buy that and the 'Pocket PC Game Programming Using The Windows CE Game API' book, and see how things progress from there.

Thanks for the info guys... If anyone has any more ideas, I'd love to hear them.
Conan · 01 Oct 2002, 11:08 UTC — getting going
the sooner you start the better. Don't put it off.
You cannot write a quality game without using C and depending on the toolkit C++.

Using a toolkit like GapiDraw or PocketFrog you get a complete working framework so you can ignore much of the hastle of getting the thing working and concentrate on writing a game. Added to that you get devide independance.
Lazarus wrote:
I've been reading SAMS Teach Yourself Visual C++ in 24 Hours, with the idea that it would open up how to use classes, structures, header files, resources, API's etc. etc. within eVC++, but the whole application configuration and setup issue seems to baffle me immensely. Because C++ is so configurable, it might take me a year or so just to get that bit right!


Mr.Prayer wrote:
I think "Pocket PC Game Programming: Using the Windows CE Game API" will be best choice.


First of all, I have the PPC Game Programming and a Sams Teach yourself in 21 days and the Sams book explains using MFC and creating applications, where the PPC Game Programming book goes right into programming games. I has you build your own library like GAPIDraw, so you get a good idea of how it works "under the hood".

If you type out all the examples, not only do you get familiar with the C++ Syntax, but you also get a good idea about setting up classes used in games. I read about 3/4 of the book and started creating my own games, because I started getting plenty of ideas just from reading.

The first game I did, used the game library in the book, which I'll probably convert over to GAPIDraw. The second game, which I am working on now, just uses GAPIDraw and is coming along well.

For learning the langauage, I would definitely recomment the PPC Game Programming book and just jump right into your own project when you feel comfortable enough with the language.
Same here. My first project was using a heavily modified version of the GameLibrary from Jonathan Harbour's PPC Game Programming book. My current project is using GapiDraw.

Look at the sample programs that come with GapiDraw. The 'Simple' program is a pretty good application to tinker around with since it presents the basic concepts in a logical manner. Try to learn what you need to learn to get the job done. Eventually you'll have mastered the basics of C++ and can move on to the more esoteric subjects.


In a nutshell, you don't need to learn everything there is to know about C++ to write a decent application. You'll learn better techniques over time - the main thing is to get up and running quickly and feel comfortable with the basics.

-- GR
It's ironic that you all should mention this. I got so far as chapter 5 in the SAMS book and then realized that the damn thing had nothing left to offer me... It just went on more about how to use the native ActiveX controls. I started tinkering around with the simple example supplied with GAPIDraw, and with some chewing and ahhhing, worked out exactly what was going on and why (though I would like to ask what HRESULT is and TCHAR & DWORD. Well, I know they are variable types, but I don't exactly know things like the bytes they take up or their uses and limitations. Also, this Blit thing is a bit new to me... Though I do know that it's graphic based.

I guess I'll just have to keep tinkering with the info I have gleaned and see what I can accomplish.

On a requestful note... Is anyone out there willing to offer me any sample code on how to use a sprite in relation to stylus/button movement (ie to learn how to cycle the sprites frames etc.)???

Thanks again guys. You've all helped me alot - especially with the enthusiasm. :D
The sprite code in Harbour's book is pretty good for a starting point. I definately recommend getting the book to help understand the basics of the pocketpc. Other than that, there are several good websites that provide pocketpc programming tips.

-- GR
Conan · 02 Oct 2002, 12:08 UTC — Sprite sample
My pocketFrog resources include a sprite class sample ( www.sundialsoft.co.uk ) and the EasyCE toolkit also has sprite stuff in it.

Animating sprites is quite simple. You need
the sprite frames organised so you can get at them
a sprite class with variables for things like speed of animation, x,y, movement etc and a main game loop which runs through all your sprites seeing which ones need to be moved, deleted etc.
I'm learning C++ right now too, and I want to eventually make a game with GAPIdraw. I'm reading the book C++: How to program by Deitel & Deitel. It looks like a good book, my brother borrowed it from a friend who is a master programmer ;)

It doens't have any crap about how to use IDEs or windows programming. Just console programs. I think that's the best way to learn a language though, you can focus on learning the LANGUAGE, not learning to use a window toolkit or an ide. Once you have a good understanding of the language other stuff should come easily...
Thanks for that.

I've already read a book on C++ programming but it was a little old. It did explain all about structures and bit operators etc. though, so it wasn't a total loss. What I'll probably do is learn how to use the visual C++ IDE and then push to buying more books on actual coding practices and the like.
HRESULT is a 32 bit value used to return an error code. They are used extensively in COM and MFC. It consists of a severity code, context information, a facility code, and a status code. Once you receive an HRESULT, you can simply check for pass or failure using the FAILED and SUCCEEDED macros. If you want to know the text description of the result, use AMGetErrorText(). You can make your own HRESULTS. I do it all the time. I like the scheme.

TCHAR is a data type used for ANSI or Unicode strings. For ANSI programming, the TCHAR is a single byte char. For Unicode, it is two bytes and is the same as WCHAR. All of the modern Windows platforms use Unicode now.

WORD is a 16 bit unsigned integer. A DWORD is a double word or 32 bit unsigned integer.

Good luck and have fun!
Guest · 04 Oct 2002, 03:59 UTC — Windows specific stuff
All this HRESULT, RECT, COLOREF and especially TCHAR stuff will come back to haunt the GapiDraw author once he decides to port this library to Palm|Linux|Apple ...
Not really. They're just LONGs, DWORDs, simple structs, etc.
Yeah, but this is copyrighted stuff.
uhh, they can't copyright names and essentially that's what a variable name/data structure/class name is. You can only register it as a trademark and that means it's not a common use term and RECT, HRESULT, and COLORREF are all common use terms, atleast in this profession.
JeremieWeldin · 04 Oct 2002, 06:20 UTC
Why on earth would anyone port this beautiful library to those shitty platforms?

<flamewar mode="on">
Well, this library is anything but beautiful.
It does work but for example this entire deal with creating thread just to be able to run code like:

Code:
for(...)
{
doSomething:
sleep(1);
}


is completely unnecesary.

One could just as easily do :

Code:
for(...)
{
doSomething:
checkEvents();
}


where check events is basically wrapper around Windows Event procedure.

One more thing - why in the world blit methods waste time checking for the proper parameters without introducing any clipping code on their own ?
As a result of this, every blit routine ends up executing clipping code twice - once in the user app before calling the actual blit method and another time inside of the method itself.
This might not matter for large sprites but it does introduce problem for say 10x10 sprites etc ...
Especially if you have 50 of them.
How about this part of Windows.h ?

Code:
/*++ BUILD Version: 0001 Increment this if a change has global effects

Copyright (c) 1985-1997, Microsoft Corporation

Module Name:


windows.h

Abstract:

Master include file for Windows applications.

--*/

[/code]
Lets not get off track of the original poster's question and turn this into a flamewar. Personally, I'm quite happy with the performance and quality of gapidraw, and the support of the FREE product has been exemplary.

-- GR
Anonymous: I usually don't reply to stupid comments from anonymous posters, but this one is just too dumb to disregard. I assume you are the same guy that posted that TCHAR is Windows-stuff and that TCHARs are copyrighted by Microsoft.

First of all you are totally off topic, second of all you are simply wrong in all cases. If you don't like the library, then please get off the forum and let us use it for actual programming tips.

(1) Data types

As Hosed mentioned, porting GapiDraw to other platforms is dead simple. The data types are simple primitives. If you have the time, please check the source code for Unreal Tournament (which is released on the web) and you will find lots of TCHARs etc.

(2) The event loop 1

The reason for using a separate thread has been discussed previously on the forum. The reason is simplicity. If you own Game Programming Gems vol. II this topic is discussed as the "linear programming model". The advantage of using the linear programming model is that you actually can have code like:

if (m_bShowGameIntro)
{
ShowIntroScreen();
Sleep(3000);
m_bShowGameInto = FALSE;
}

This is not allowed in your simplistic one-thread case. The advantage of the linear programming model is simply easier to manage code with much less conditions.

(3) The event loop 2

Since you obviously have never progammed a real-time windowed application (not windows application - windowed) I can inform you that you do not want to update game data in the same thread as the one receiving windows events. You need higher priority in the game update thread otherwise the game will stall when e.g. the window is moved around on the display (since all windows use the same priority).

The advantage with multiple threads is that you can finetune your game performance so it actually runs nice in a window. Check out discussion topics at flipcode or gamedev for more information on this.

(4) Clipping

As mentioned a dozen times earlier, GapiDraw uses UNSIGNED coordinates for full DirectDraw compatibility. Clipping would only work on two edges. If you use your own clipping code you can easily disable the internal verification for each surface, and you will not get the overhead you mentioned.

This topic is now closed.

Anonymous: If you have any comments on this you are very welcome to email me at johan.sanneblad@home.se

/Johan