Using size greater than screen size

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
BonneCW
Just popping in
Just popping in
Posts: 8
Joined: Sun Sep 25, 2016 21:49

Using size greater than screen size

Postby BonneCW » Sat Oct 29, 2016 13:46

Hey,

I have a problem with a background image for my game. The image has a resolution of 1920 x 1080 and is designed to work with resolutions down to 1280 x 720. In this case just the inner section of the image shall be shown (Position: (Resolution.width - 1920) / 2, (Resolution.height - 1080) / 2; Size: 1920, 1080). The positioning is no problem, but the scaling doesn't work. It seems like CEGUI (using 0.8.4 right now) always scales the image down to e.g. 1280 x 720 if this resolution is selected. For setting the size I use

Code: Select all

_window->setSize(CEGUI::USize(CEGUI::UDim(0.0f, float(w)), CEGUI::UDim(0.0f, float(h))));


with w = 1920.0, h = 1080.0 and _window is a CEGUI::Window (in this case a StaticImage).

The imageset looks like this:

Code: Select all

<?xml version="1.0" ?>
<Imageset name="MainMenu_Background" imagefile="ui_screen_bg_1_wBorders.png" nativeHorzRes="1920" nativeVertRes="1080" autoScaled="false" version="2">
   <Image name="Background" xPos="0" yPos="0" width="1920" height="1080" />
</Imageset>


I disabled autoScaled because I thought this might cause the scaling, but it doesn't work.

Is it possible to use a scaling greater than the screen size without rescaling it? I think it should, don't see a reason why this shouldn't be possible. Is it a bug or am I doing something wrong?

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Using size greater than screen size

Postby YaronCT » Sat Oct 29, 2016 15:35

@BonneCW: What do u mean by "designed to work with resolutions down to 1280 x 720"? Afaik an image has 1 size and that's it.

What do u mean by "if this resolution is selected"? Where does the 1280x720 come from? I don't see it anywhere in the code or xml files you've posted.

User avatar
BonneCW
Just popping in
Just popping in
Posts: 8
Joined: Sun Sep 25, 2016 21:49

Re: Using size greater than screen size

Postby BonneCW » Sat Oct 29, 2016 15:51

With designed to work with different resolutions I mean, that the most interesting part of the image is in the middle and parts of the sides (left, right, top, bottom) can be cut. Example: http://clockwork-origins.de/ElementalWar/main_menu.html

The buttons and the logo are placed relative to the screen size (but their size is constant). The background always has a size of 1920 x 1080 independent of the screen resolution, but in case the resolution is lower than 1920 x 1080 parts of the edges are cut away.

Does that explain it better?

The selected resolution is the one I selected in my game, so it's the display size used.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Using size greater than screen size

Postby YaronCT » Sat Oct 29, 2016 15:57

@BonneCW: Ok I get it, forgive me I'm a bit tired..

Do plz test it with the latest cegui, preferably the head of branch "v0-8", or at least the latest 0.8.x release (currently 0.8.7) and tell me if the issue is still there. If so, I'll try to reproduce the issue.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Using size greater than screen size

Postby Ident » Sat Oct 29, 2016 17:11

I am not sure what you mean but so far I do not feel this is a CEGUI bug but rather that you do not yet know how to achieve waht you want. In order to help you with that, or to figure out if it actually is a bug, could you make images displaying how the background image should behave in the desired resolutions of your application? To be honest, after reading all this and checking your link I am still not 100% sure what you expect the background to look in the smaller version.
CrazyEddie: "I don't like GUIs"

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Using size greater than screen size

Postby YaronCT » Sat Oct 29, 2016 17:30

@Ident: I've understood what he wants.. just to see the middle of the image, cropped. *If* he did everything right, and that doesn't happen, then it's a bug.

User avatar
BonneCW
Just popping in
Just popping in
Posts: 8
Joined: Sun Sep 25, 2016 21:49

Re: Using size greater than screen size

Postby BonneCW » Sat Oct 29, 2016 17:36

Checked 0.8 branch, same problem there.

@Ident: Yeah, maybe I'm using the wrong approach to reach my goal.

I uploaded another graphic to explain what I want to reach.

Image

On the left side the screen resolution is the same as the one of the image, e.g. 1920 x 1080. So I start my CEGUI::Window at position 0/0 and set a size of 1920/1080 in absolute pixels or 1.0/1.0 relative (doesn't matter in this case).

On the right side the screen resolution is smaller than the image resolution. The small rectangle is the screen, the big one the image. Actually CEGUI rescales my image so it looks also for the smaller resolution like on the left side. But I want it to be as on the right side, so I see just the inner segment of the image as shown in my graphic. The position using offsets works as expected, so with a screen size of 1280 x 720 I use setSize with -320 and -156 as start position. This works fine so far, so the start point is really left above the screen. The problem is that the size seems to be set to 1280 x 720 automatically, even though I use setSize with 1920/1080.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Using size greater than screen size

Postby Ident » Sat Oct 29, 2016 20:05

What type of Look N Feel are you using for the window with the image in it? If it is a StaticImage, try a different formatting, i.e. set HorzFormatting and VertFormatting to something different than "Stretched", e.g. LeftAligned and TopAligned respectively or CentreAligned, or Tiled or whatever.

Or... can you please check out the size of the window after you did setSize and check what the window is actually having set as size there? I remember we had some issue with bigger-than-screen sizes of windows but I think that was about relative sizes only (I might be wrong though). I fixed that on default branch but on 0.8.X we cant fix it because it changes behaviour. So anyways, we need to know what the cause of the issue is. A minimal repro (e.g. if you got our samplebrowser running, modify the HelloWorld and post it here to show the issue) would instead or additionally also be helpful.
CrazyEddie: "I don't like GUIs"

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Using size greater than screen size

Postby YaronCT » Sat Oct 29, 2016 20:13

@Ident: But y shouldn't "Stretched" work here?

User avatar
BonneCW
Just popping in
Just popping in
Posts: 8
Joined: Sun Sep 25, 2016 21:49

Re: Using size greater than screen size

Postby BonneCW » Sat Oct 29, 2016 20:21

Okay, using CenterAligned works. Didn't know this is necessary. Is it the only option or shall I provide a code snippet in the sample browser to reproduce this even with Stretched Look N Feel?

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Using size greater than screen size

Postby Ident » Sat Oct 29, 2016 21:53

YaronCT wrote:@Ident: But y shouldn't "Stretched" work here?

I don't know. It should work. Do you wanna investigate what is going on?
CrazyEddie: "I don't like GUIs"

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Using size greater than screen size

Postby Ident » Sat Oct 29, 2016 21:55

The reason I suggested non-Stretched mode is because it gives you the image in the native resolution on the screen, which is what BonneCW wanted.

My suspicion is that the original stretched stuff doesn't work because the window is resized somehow
CrazyEddie: "I don't like GUIs"

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Using size greater than screen size

Postby YaronCT » Sat Oct 29, 2016 21:56

@Ident: What m i, your servant?! Pay me and perhaps I'll look.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: Using size greater than screen size

Postby YaronCT » Sun Oct 30, 2016 19:07

I'm looking at it.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Using size greater than screen size

Postby Ident » Sun Oct 30, 2016 23:47

"Yaron" means "butler "in my language and butlers here don't get paid, as we still have feudal rule here and are very proud of it. Crazyeddie is the local feudal lord, he stops by from time to time if he is not on a military campaign, the current one has been lasting for quite some time. Now back to work, or we do not get our bag of wheat this winter.
CrazyEddie: "I don't like GUIs"


Return to “Help”

Who is online

Users browsing this forum: No registered users and 33 guests