Window Resolution (solved?)

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Window Resolution (solved?)

Postby ShadowTiger » Mon Aug 02, 2010 23:42

Sorry if this has been asked before, I have no idea how to search specifically for this problem. Its not really related to CEGUI, but maybe someone here knows about this problem.

I am using Cegui 6.2, direct 3D/ Direct X 9 renderer.

we are trying to run the game at 1024x768

however, the game actually runs at 1034 x 786 (edit: maybe this is wrong), which ruins our aspect ratio.

update: After testing, changing the input resolution to 1014 x 758 produces the correct 1024x768 resolution when we run the application. I'll test this with different resolutions.

Update 2: Okay it seems like it adds 10 pixels no matter what to the width and the height, this is easy to fix, just subtract 10 pixels when you set the resolution.

this is the relevant code to change the window size

Code: Select all

GAME_WINDOW_X_SIZE = 1024; //global
GAME_WINDOW_Y_SIZE = 768; // global

         RECT wnd_size = {0,0,GAME_WINDOW_X_SIZE,GAME_WINDOW_Y_SIZE};
         AdjustWindowRect(&wnd_size, WS_OVERLAPPEDWINDOW, FALSE);

         // create new window
         pimpl->d_window = CreateWindow(APPLICATION_NAME, APPLICATION_NAME,
                          WS_EX_TOPMOST | WS_CAPTION  /*WS_POPUP*/,
                          0, 0,
                          wnd_size.right - wnd_size.left,
                          wnd_size.bottom - wnd_size.top,
                          0, 0, GetModuleHandle(0), 0);


The problem is simple, the game window is too big! It is something like one percent bigger than the resolution we want. This causes all of our images to be stretched. We tried using native resolutions to fix the blurry text from re-sized images and that's how we discovered this problem.

So am I doing something wrong? I can post more of the renderer code if it is necessary. This seems like a bug/feature inherent to the API for creating windows, so I feel like I may need a workaround like using a modified resolution to compensate. Hopefully there is a better solution.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Window Resolution (solved?)

Postby CrazyEddie » Tue Aug 03, 2010 18:53

I'm not sure what's going on there then - clearly you're doing the same as we do in the samples framework, which to the best of my knowledge works ok. Do you get the same issue in the CEGUI samples? Or is it just with your own app?

I'm not sure what I might be able to suggest; I'm not a big Windows programmer these days :)

CE.

ShadowTiger
Quite a regular
Quite a regular
Posts: 46
Joined: Fri Mar 19, 2010 05:31

Re: Window Resolution (solved?)

Postby ShadowTiger » Tue Aug 03, 2010 20:40

Yeah don't worry about it, I just posted this as an awareness thing... this could happen to YOU!!!

I will just add this to our long list of quick-fixes and workarounds :hammer:


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 7 guests