PocketMatrix forums

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

Datatypes/Structures not listed?

While toying with gapidraw, I keep coming across types that I haven't seen, nor can find documentation on.
For example:

Code:


CGapiApplication::StylusUp
virtual HRESULT StylusUp(POINT p);



I have no idea what the POINT structure looks like...

OR

Code:


CGapiSurface::SetColorKey
HRESULT SetColorKey(COLORREF dwColorKey);



I didn't know what the COLORREF datatype was... had to see an example. That just seems to call a function or something anyhow, so who knows what the REAL result is... I was trying things like 0xFFFFFF and such :)

Is any of this listed somewhere?
POINT and COLORREF are part of the windows API.

Check the help in EVC.

Pam
Thank you kindly, sir ;)
To refrain from creating another thread, I'll just post this problem here...

I'm trying to test a pixel on a surface...

To the best of my knowledge, COLORREF is a 32 bit value represented in HEX as:

0x00bbggrr

So white should be:

0x00FFFFFF

OR:

RGB(255,255,255)

However, when I do a test for these values, it doesn't work. Here is the code (I'll ommit all of the context):

Code:

COLORREF pixelTest;
rg->GetPixel(carList[i].xPos + 12, carList[i].yPos + 12, &pixelTest;);
carList[i].roadFriction = getFriction(pixelTest);

double getFriction(COLORREF pixel)
{
double friction = .95;
COLORREF tempPixel = 0x00FFFFFF;
if (pixel == tempPixel)
{
friction = 1;
}
return friction;
};


Can any body shed some light on this problem? Thanks!
Keep in mind that on Pocket PCs pixels are a 16 bit value. RGB data is stored in 565 format, 5 bits for Red, 6 for Green, and 5 for Blue.

White is 0xFFFFFF.

If I'm not mistaken, GapiDraw stores all Surface data as 16 bit (565) pixels regardless of platform (PC, PocketPC, Symbian, etc.)

Pam
I tried that too, and no luck :(

But you don't see anything wrong with the code then?
Well, I hate to mention this, but you really need to check those return values for GD operations. Assuming that they will always be successful will cause you nothing but grief.

When you define:
Code:

COLORREF tempPixel = 0x00FFFFFF;

it would actually be easier to understand if you say:
Code:

COLORREF tempPixel = RGB(255,255,255);


I'm not positive that white actually ends up as 0x00FFFFFF in the conversion, but it probably does. I typically predefine my basic color set in a header - white, red, black, magenta... this makes it much easier to work with in the code.

What is the value of pixelTest in your example?

Are you developing on the desktop? If so, walking through the code with the debugger is simple enough. You can also debug directly on the device using eVC. You may also want to look into using STLOG on the ppc dev network website. It's a very handy data logger that you just drop into your code. I use it quite a bit when I have to debug directly on the device.

Hope this helps. :)
Well, problem is, I can't display integers on drawtext, so it makes it tough to know values... I had errors when I tried using the code provided in another thread, and didn't wanna keep bugging people about it right now ;)

So I haven't got a clue what the value is, or I'd be able to figure out th eproblem heh.
Are you developing and testing on an emulator (painful to say the least)?
No, directly to device
It's not particularly pleasant, but you should step through the code in the debugger and see just what the values really are.

Pam
As for writing out an integer (or float, or string) value, take a look at either the simple or gdidemo in ProcessNextFrame. There is an example of how to 'draw' the text you're interested in. Also, definately check into STLOG - it is really easy to use and can provide you a wealth of information when you're debugging. Sometimes the eVC debugger gets lost when debugging directly on the device, and STLOG will help you there.
Heh okay, I guess I'll just have to get that text readout working ;)
heh, yeah, that was me :) But it didn't work! :)