PocketMatrix forums

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

Just starting, having trouble already...

Well, I got the Blit sample working, not too tough.

Now I'm trying to do my own thing. I'm getting a GPF when I try and blit an image. Here's the entirety of my code:

Code:

#include <PocketFrog.h>
#include "MyFirstGame.h"

CComModule _Module;

using namespace Frog;

class MyGame : public Game {

private:

Surface* logoImage;

public:

MyGame() {
PocketPC::GetModel();
m_config.szWindowName = _T("MyFirstGame");
m_config.orientation = ORIENTATION_NORTH;
m_config.splashScreenTime = 0;
}

virtual bool GameInit() {
DisplayDevice* display = GetDisplay();
otxLogo = LoadImage(display, IDR_LOGO_IMAGE);
otxLogo->SetColorMask(Color(0, 0, 0));
return true;
}

virtual void GameEnd() {
delete logoImage;
}

virtual void GameLoop() {
DisplayDevice* display = GetDisplay();
display->Blit(0, 0, logoImage);
display->Update();
}
}

virtual void StylusDown(Point stylus) {
}

virtual void StylusUp(Point stylus) {
}

virtual void StylusMove(Point stylus) {
}

};

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR, int) {
_Module.Init(0, hInstance);
MyGame game;
game.Run();
return 0;
}


Trying to run in the emulator, PocketPC platform.

The image is a bitmap resources, 100x100x256, RGB-encoded Windows/OS2 bitmap. Loads fine in Paint Shop Pro, which is where I saved it from.

The GPF info is:

"The instruction at 0x0040180d referenced memory at 0x00000010. The memory could not be written."

Any ideas?
You code looks ok, I suspect it is unable to load the image file.

Could you try using a .JPG image instead and see how it goes? When inserting the .JPG in the resource file, make sure you specify it's class as "image".
fzammetti · 09 Jul 2002, 21:32 UTC — Aahh...
Well, I didn't try JPG's yet (I will later, I'd prefer all my images be JPG's anyway), but your post gave me the answer, perhaps unintentionally...

I am porting a game I am writing from my own proprietary graphics library (which I've thus far been unable to get working on iPaqs) to PocketFrog as a fall-back in case I can never get my own code to work.

Well, in my project all my images are RAW graphics files with a special header, they are not imported as resources as images, they are just a custom resource type.

Seems to be a requirement for images in PocketFrog that they are imported as images.

Which makes perfect sense of course, I just didn't know it. Thanks very much!
Actually they can be imported with any class name... Simply specify it to the LoadImage() function. "image" is only the default value...

ex:
LoadImage( display, IDR_IMAGE, "class" );
Ah, that's cool!

Is there documentation of all the functions available with PocketFrog that I am not aware of?

Thanks again!
Conan · 10 Jul 2002, 09:40 UTC — .RAW files
Note that Burning Sheep's plasma demo uses a .raw file for the sheep in the demo so you can see the syntax there.

Re: docs other than the stuff on the PF site & my beginner's guide there's the asteroids source for an older version plus a few demos.

There are numerous not so obvious things you can do with surfaces so a look through the posts on the forum is essential.

I suggest a look at the header files to see the various overloaded functions for the commands as you can see what parameters they take & work out the hidden features.
That plasma demo would be very helpful, where can I get that? Didn't see it on the PocketFrog site and a scan through this message board didn't turn it up...
Ah, never mind, I just found it. (different search term)
fzammetti · 04 Dec 2002, 21:29 UTC — Revisited
I'm replying to this thread because I just encountered the issue again, and I tried the solution originally suggested, i.e., specifying the resource class when loading the images. It didn't seem to work. However, as soon as I reimported the images specifically as BMP's, all problems went away.

I'm just posting this in case anyone faces the same issue, maybe this will save you some time and headache. Of course, if anyone can solve the problem for me that would be great too. As it is I don't have a problem importing specifically as BMPs (I haven't had cause yet to try JPGs so I don't know if the same problem exists), the only reason it's an issue at all for me is simply or organization: if I'm doing a game with multiple screens, I like having each screen have it's own resource folder for images, but now it doesn't seem that I can since they all need to come in as the same resource class. Not a big deal in the end.