PocketMatrix forums

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

the book POCKET PC GAME PROGRAMMING USING WINDOWS CE

anyone eles out there use this? Everything was working fine until chapter 7. This game library example that is suppose to show objects moving shows no objects..

so before I spend hours trying to figure it out I was tihnking maybe other people have ran into this too. I have a toshiba e310
I own it, and use it as a refrence, but the author doesn't incorperate enough gapi into the library. He let's windows GDI handle it, which is a huge bottle neck. As for your problem, there are accounts of the source on the cd being inaccurate, but the code in the book being correct. Make sure you compare the 2 if you are not coding it yourself.
UMCP_matt · 24 Jun 2002, 21:04 UTC — I am running it right from the CD
in chp7/project01

The text shows ok but the objects that shoudl be moving are not there

another general question.. how come sometimes a program gives exceptions when running in debug mode but run fine in release mode?
UMCP_matt · 24 Jun 2002, 23:11 UTC — figured it out.. author put updatewindow() in wrong place
Code:

BOOL CGameLibrary::Initialize(int nCmdShow)
{
WNDCLASS wc;
RECT rect;

MsgBox(_T("CGameLibrary::Initialize"));

//If it is already running, then focus on the window
hWindow = FindWindow(szWindowClass, szTitle);
if (hWindow)
{
SetForegroundWindow ((HWND) (((DWORD)hWindow) | 0x01));
return 0;
}

//Register the window class
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetInstance();
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(GetIcon()));
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = szWindowClass;

if (!RegisterClass(&wc;))
{
Error(_T("Could not register window class!"));
}

GetClientRect(hWindow, ▭);

if (GetFullscreen() || G_Enabled())
{
hWindow = CreateWindow(szWindowClass, szTitle,
WS_VISIBLE, 0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, hInstance, NULL);
} else {
hWindow = CreateWindow(szWindowClass, szTitle,
WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, NULL, NULL, hInstance, NULL );
}
if (!hWindow)
{
Error(_T("Could not create the game window!"));
return FALSE;
}

//ShowWindow(hWindow, nCmdShow);
//UpdateWindow(hWindow);

if (G_Enabled())
{
//initialize the GAPI display for fullscreen
if (GXOpenDisplay(GetWindow(), GX_FULLSCREEN) == 0) {
return FALSE;
}

//retrieve display properties
gxDisplay = GXGetDisplayProperties();

//make sure 16-bit color is available
if ((GetBitsPerPixel() != 16) || (!IsScreenFormat565()))
{
Error(_T("Full 16-bit color display is required!"));
GXCloseDisplay();
return FALSE;
}
}

ShowWindow(hWindow, nCmdShow);
UpdateWindow(hWindow);

return TRUE;
}
R0B · 25 Jun 2002, 00:28 UTC — I am running it right from the CD
UMCP_matt wrote:
another general question.. how come sometimes a program gives exceptions when running in debug mode but run fine in release mode?


Well, those exceptions exist, but are not important enough to halt opperation, so in release mode, you don't notice them.
It might be that the author has checks within the code to flag unexpected conditions and issue a DebugBreak or assert, but only during a debug build. Have you run the code under the debugger and looked at the line of source corresponding to the exception?

Any programmer who ignores exceptions such as these should walk away from the computer and consider a career in lawn maintenance.
That source only seems to open a full screen window and update it, it doesn't load or create any images unless I missed something. I don't think that does anything other than create a blank full screen window :/, just initializing the game library (hence the name of the function). You need something more than that.

The author of that book likes to put tiny mistakes (intentionally or unintentially) to catch users into reading the code and thinking for themselves. Be sure you look over the code always.

Oh, and next time you paste code on these forums please use the [ code ] and [/ code ] tags, no spaces. Or just click the button that says "Code" on the reply page above the font size selection.
Digby wrote:
It might be that the author has checks within the code to flag unexpected conditions and issue a DebugBreak or assert, but only during a debug build. Have you run the code under the debugger and looked at the line of source corresponding to the exception?

Any programmer who ignores exceptions such as these should walk away from the computer and consider a career in lawn maintenance.

I disagree. Most times, you should throughly examine the problem and solve it. However, there are some cases where, for what ever reason, debug mode decides to throw out an access violation when there is none, and the work around (for what poses no problem at all) would be too much trouble. I expereanced one of these special cases (actually the only one I've ever expereanced like this) when porting doom legacy. There was clearly no problem with the code or what it was doing, but rather a problem with the debugger.
I wouldn't mention that at a job interview Rob, unless it was followed by your knowledge of fertilizer.
What, that the debugger had a mistake? No, come on, you, as well as I, know the eVC++ is not without it's faults.
Experience NOT expereance rob
it would help if you would quote things that don't relate to the post above it. Also, it has been established that I have poor spelling, so I don't see your point.
UMCP_matt · 25 Jun 2002, 18:55 UTC — the clip of code
was just part... the problem was calling gxstartdraw before it called the gxopenproperties()

anyone else use this book to learn? I find it to be the best programming book I have ever read as far as the knowledge I am getting from it and how well I can understand it
I bought it a year or so ago. If you search the archives here you'll find my complaints about it.

It's good that you're getting something accomplished by going through the samples in the book. You're the first person I know that has.
I'll point out one of my biggest complaints here (you may have already said it). The author doesn't use enough gapi to make the library. He stays with the windows GDI for a good part of the library, almost as if he didn't want to take the time to rewrite those routines. Now, I understand, if he were to explain how to rewrite all of those, the book would be much thinker, but he could have included a compiled version, and the source to a complete GAPI game library. Oh well. Also, it didn't look like he optimized all of his code.
angedelamort · 26 Jun 2002, 01:48 UTC
I think the author only introduce some concepts. I don't think he would release a powerfull engine for a beginner book and for a little price.
My opinion: I don't like the way he use the windows lib for games... But if you want to begin somewhere it's really interesting. And I think it's a good exercise to try to make his source code works :P I had some problem with that too lol.
Yes, an excilent book. You know what would be great, if somebody wrote a book that delt with one of the game libraries hosted by pm.
On the back cover of the book, near the bottom, there is a mention of the target audience for the enclosed material. It's marked "Beginner/Advanced".

How can something be written for beginners and at the same time be for advanced game developers? The book is obviously a beginner-level text.
It is a beginner's book. It's a good book, but still a beginner's one.

It is also the book who motivated me to start working on PocketFrog. If you've seen the older versions (pre 0.5.0), they look quite similar to the author's own library.

I was also thinking about writing a book myself when the author contacted me. He basically said that if he was ever to write another book on PocketPC game programming, he would like my input after seeing what I did with PocketFrog.

Altough I think it's a great idea, I don't see myself spending time on this when I can't even find any to write proper docs for the library.
UMCP_matt · 26 Jun 2002, 23:30 UTC — more problems
he also has program calling BMP files that never exist..

oh well I guess its good practice to go make my own.. mayb eits on purpose?

I am confusde when you all say he does not use GAPI.. I though that is what is at th eheart of th eDrawPixel function ???
drawpixel yes. But he does not use it for full screen blits, to draw sprites, ect. And these are much more common to use than his pixel routine.
UMCP_matt · 27 Jun 2002, 19:55 UTC — what is the reason for that?
IS it that much more complex? Is that why he avoided it?

how much of a slow down does doing it his way cost vs. gapi.. 2x.. 3x?