PocketMatrix forums

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

VGA Pocket PC

Hello there,

I'm using some of the code of the blaster demo, and while I was trying the input handling, I found that for some reason, the E_INPUTEVENT object is giving me the wrong values for X and Y.

Some of the code:
Code:

E_INPUTEVENT InputEvent;

RECT x;
x.left = 0;
x.top = 0;
x.right = 100;
x.bottom = 20;
Buffer->FillRect (&x;, E_RGBX(51, 102, 153));
Buffer->DrawFont (0, 0, &Shared-;>font, InputEvent.clickx);
Buffer->DrawFont (50, 0, &Shared-;>font, InputEvent.clicky);


This gives the following (I'm using screen rotation):
TopLeft Corner : 320,0 (Should be something like 0,0)
TopRight Corner : 640,0 (OK)
BottomLeft : 320,240 (Should be 0, 480)
BottomRight : 640,240 (Should be 640,480)

Why is this happening?


By the way, using the exact same code but with a 320x240 emulator, there is no problem. The problem occurs both with my device and the VGA emulator.


Regards,

Joao
Hi Joao,

This looks like a bug. We need to look into this issue. What VGA device are you using?

Thanks!
Hello,

I have an Acer n311.

This also happens in the 2003 VGA simulator in Visual Studio 2005.


Regards,

Joao
Hi Joao,

Can you tell us the settings you use in the Edge configuration, is config->resolution set to ERS_DEVICEDEFAULT?

If you're building for Windows Mobile 2003, did you change the resource file to allow native VGA? More information about it can be seen here:
http://www.edgelib.com/index.php?node=38 (look at the chapter "Native high-resolution applications")
I'm using the same project file form Blaster, but I'm not sure about that specific parameter.

I'm going to check that at home and then I'll let you know.

Joao
Hello there,

There was no parameter so I tried all possible and the result was the same...

Code:

ERESULT ClassMain::OnCreate(EDGECONFIG *config, EDGEDATA *data)
{
config->ffwdkey = 'A'; //A key for fast forwarding (multiplies framerate by 2.5)
config->slomokey = 'S'; //A key for slow motion (halves framerate)
config->maxfps = 60; //Limit the maximum frames per second by 60
config->flags = EFL_NOTEARING; //Desktop PC: Enable VSync to prevent tearing in displaying frames
config->enginestatus = true; //Desktop PC: Enable the status bar and status information icon
config->engineconsole = false; //Desktop PC: Disable the edge console
config->jogtiltarrow = true; //Emulate the UIQ jog as left/right arrows
config->videowidth = XRES; //Desktop PC: Custom display width
config->videoheight = YRES; //Desktop PC: Custom display height

//Determine screen orientation
if (XRES < YRES)
config->rotation = ROT_PORTRAIT;
else if (XRES > YRES)
config->rotation = ROT_LANDSCAPE;
else
config->rotation = ROT_AUTO;

config->resolution = ERS_REQUIREHIGHRES;

return(E_OK);
}


Regards,

Joao
I've been messing around with this code and if you comment the rotations, the XY coordinates look a little better, but they are between 0,0 and 320,240.

I believe you have two bugs:
1. Although using ERS_REQUIREHIGHRES, the coordinates are still the same for 320x240 devices.
2. When using rotation, the coordinates become cofused.

Hope this helps.

Regards,

Joao
Hi Joao,

Can you tell us which workspace you use for building the Blastar sample, maybe you can attach the workspace to this topic?

Also, would you like to download the VGA version of S-Tris 2 from http://www.elementsgames.com/stris2 and check to see if stylus input is correct?
Hello,

I've downloaded s-Tris2 and found no problems in the PDA.

I've created a small example from your helloworld and adapted the solution file to compile from Visual Studio 2005 into my pocket. Attached it is the project files and the executable. If you can, please try it in a VGA device to test.

The application is very simple. It places a "*" in the topleft corner, a "#" in the topright, a "+" in the bottom left and a "&" in the bottom right. The coordinates are such that only a VGA device can see (between 0,0 and 640,480).
Then, when you move the stylus in the screen, it will show the coordinates from the events OnStylusUp, OnStylusDown and OnStylusDouble.

As you can see in the attached images, in the device, the topright corner shows 236,0 while the pointer is over the "#" symbol. It should be about 480,0. In the second image, I'm holding the stylus in the bottomright corner near the "&" symbol, and the coordinates are 237,318 when it was supposed to be about 480,640.

Conclusion, the VGA device is in VGA mode (the symbols show that), they are being drawn in the correct places, but the input coordinates are based in 320x240 screens.


Can you please check this?

Regards,

Joao
Attachments:
VGATestWithPhotos.zip (716 KB)
Hi Joao,

I've found the cause of the problem.

Because Windows Mobile 2002 and 2003 automatically uses an emulation mode for VGA graphics and input, you need to manually edit the resource.rc file of your workspace.

I've modified your resource file and attached it to this message. Download and replace the one you currently have. Take a look at the bottom of the file with a text editor to see the modification.
Attachments:
resource.zip (1 KB)
Hurray!!!

Yes, it did solve the issue.
Is this resource parameter documented anywhere in the documentation? I was unable to find it.

Anyway, thanks for the solution.

Regards,

Joao
Hi Joao,

Great to hear everything is running fine now :)

The resource file setting is documented in the Windows Mobile getting started tutorial. However, I've added a FAQ entry with a more detailed description.