Page 1 of 1

HI_RES_AWARE in runtime?

PostPosted: Apr 12, 2008 @ 4:05pm
by Kak
Hi all,

is there any way to revert pocketHAL from 480x640 to 240x320 with pocketHAL?

I already have too much versions to be compiled and I think it's a mess (thanks Microsoft) that you can't decide the screen resolution other than at compile time. I wouldn't care in smartphone, as I usually handle both resolutions at runtime, but 480x640 is too big to get a decent framerate.

TIA!
Kak

edit: extra question... is there any way to decide if a device has a pointing device or not?
In theory there should be no difference between WM6 standar and WM6 professional from PocketHAL's standpoint, isn't it? I mean, could be an app produced that works in both "smartphones" (no pointing devices) and "pocket PCs" (with pointing devices) ?

(I find microsoft messed it with standar/classic/professional once again)

PostPosted: Apr 12, 2008 @ 9:19pm
by Kzinti

PostPosted: Apr 12, 2008 @ 11:06pm
by Kak

PostPosted: May 12, 2008 @ 7:53am
by hrissan
I can tell you what we do in our iwindowsmobile.com software. We compile SINGLE version - target Smartphone 2003 SDK. Then all functions absent in Smartphone 2003 is loaded via LoadLibrary/FindProcAddress. We have single EXE file which runs on many devices (older/newer smartphones/pockets).

Regarding pixel doubling here what we do - we have written a special versions of Blit/Stretch functions which can do pixel doubling. So we scale up all coordinates, and also we scale up font size.

So on VGA we have obviously scaled up images, but we also get very smooth fonts... Pixel doubling on final picture is just wasting nice VGA screens, don;t do it. :)

PostPosted: May 12, 2008 @ 8:42am
by hrissan
Also to detect between smartphone/pocket we use

wchar_t strbuild[ 20 ] = {0};
SystemParametersInfo(SPI_GETPLATFORMTYPE, 20, strbuild, 0);
std::wstring str( strbuild.get_data() );
return os::tolower(str) == L"smartphone";

And to detect screen parameters, we use

ScreenResolution Application::get_shell_resolution()
{
ScreenResolution result;
os::HDCScreen scr;

result.dpi = GetDeviceCaps( scr.get_hdc(), LOGPIXELSY );
result.size = Point(GetDeviceCaps(scr.get_hdc(), HORZRES), GetDeviceCaps(scr.get_hdc(), VERTRES));
result.orientation = PHAL::GetShellOrientation();
result.client_area_size = result.size;
return result;
}

Where ScreenResolution is ordinary struct and HDCScreen is C++ wrapper around GetDC(0)

And later when we need to decide on scaling, we use

scale_shift = 0;
if( screen_resolution.dpi >= 192 )
scale_shift = 1;

scale_shift is just log2(scale) so we can use x <<= scale_shift everywhere.

This simple "if" is in accordance with Microsoft documentation - DPI has nothing to do with actual size of pixels, it's just a flag which can be used to detect VGA screens.