Register
Site Login
Site Search
Forums
Advertisement
Welcome to PocketMatrix. PocketMatrix is dedicated to providing the best online community for mobile device developers and enthusiests. What's new?

Screen size question


Screen size question

Postby patrickwai » Feb 9, 2007 @ 9:14am

Hi Edge,

For Symbian 9.1 S60, I know the graphics can be enlarged or reduced separately using the Blt(). I have the graphic set for 176x208 devices, can I enlarge the hole screen to fit the resolution 352x416?

Thanks
patrickwai
pm Member
 
Posts: 29
Joined: Jan 12, 2007 @ 2:24am


Postby edge » Feb 9, 2007 @ 9:41am

Hi Patrick,

For the 352x416 version, I recommend creating a temporary buffer which size is 176x208. Use all graphics operations on this surface instead of the display buffer and scale it using Blt() at the end of OnNextFrame() to the real buffer.

The 176x208 should use the real buffer. A good way to do this is to create a render function accepting a pointer to a buffer surface. Here is a small example:

Code: Select all









10 
11 
12 
13 
14 
15 
void RenderGame(E2DSurface *buffer)
{
    buffer->BltFast(...)
}

void OnNextFrame(ClassEDisplay *display, unsigned long timedelta)
{
    if (display->buffer.GetWidth() == 352 && display->buffer.GetHeight() == 416)
    {
        RenderGame(&temp_buffer);
        display->buffer.Blt(...);//Scale here
    }
    else
        RenderGame(&display->buffer);
}
15 lines; 6 keywds; 2 nums; 57 ops; 0 strs; 1 coms    Syntactic Coloring v0.4 - Dan East  
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby patrickwai » Feb 15, 2007 @ 10:41am

Hi Edge,

As value equals to 65536 will no scale, what should be the value if I want to double size the image?
patrickwai
pm Member
 
Posts: 29
Joined: Jan 12, 2007 @ 2:24am


Postby edge » Feb 15, 2007 @ 10:58am

Hi Patrick,

Just multiply 65536 * 2 to double size the image. 65536 / 2 will half its size.

Please note that in Blt(), x/y position 0,0 is the center of the screen.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby patrickwai » Feb 21, 2007 @ 9:58am

Hi Edge,

After using Blt() to scale the image, the program ran slowly, what is the problem?

Thanks
patrickwai
pm Member
 
Posts: 29
Joined: Jan 12, 2007 @ 2:24am


Postby edge » Feb 21, 2007 @ 12:40pm

Hi Patrick,

Blt() is an expensive operation, especially when scaling a whole buffer.

A better solution might be to scale your internal surfaces (sprite and tilesheets, title screens, etc.) when loading them. You may also create a different graphics resource pack with upscaled graphics.

Working with native high-resolution graphics is faster than doing an upscale at the end of OnNextFrame().
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby patrickwai » Feb 22, 2007 @ 2:47am

Hi Edge,

How can I scale the internal surfaces when loading?
I found the API of Symbian for zooming (TZoomfactor and MGraphicsDeviceMap), does Edge support this API? If yes, is there any reference or example?

Thanks
patrickwai
pm Member
 
Posts: 29
Joined: Jan 12, 2007 @ 2:24am


Postby edge » Feb 22, 2007 @ 8:59am

Hi Patrick,

To upscale the graphics when loading you can use Blt(). Here is an example for loading and upscaling a tilesheet (the tilesheet variable is a 2D surface and class member of ClassMain).

Code: Select all









10 
11 
12 
13 
14 
15 
16 
17 
18 
ERESULT ClassMain::OnDisplayInit(EINSTANCE instance, ClassEDisplay *display)
{
    E2DSurface temp;
    bool upscale = false;
    if (display->buffer.GetWidth() == 352 && display->buffer.GetHeight() == 416)
        upscale = true;
    if (upscale)
    {
        if (display->CreateSurface(&temp, "tilesheet.bmp") == E_OK)
        {
            display->CreateSurface(&tilesheet, temp.GetWidth() * 2, temp.GetHeight() * 2);
            tilesheet.Blt(0, 0, &temp, NULL, 0, 65536 * 2);
        }
    }
    else
        display->CreateSurface(&tilesheet, "tilesheet.bmp");
    return(E_OK);
}
18 lines; 8 keywds; 9 nums; 84 ops; 2 strs; 0 coms    Syntactic Coloring v0.4 - Dan East  
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron