WindowHeight - self.Height not centering n Stretch

Bugs will be moved here once resolved.

Post » Thu Jun 07, 2012 5:07 am

Sorry guys... my Capx is 60MB. (Msg me Ashley if you want it. I can upload it to my FTP for you if need be.) I am rolled back to r90 right now and not too worried about this. This was mainly a courtesy FYI

In r90 I used FullScreen on scale mode in r90 with success. I did not updated to r91,or r92. I did update to r93 today. I noticed it was a little better performance. The one observation I made is that in r93. The stretch(on scale) video mode causes my menu images that used to be centered in r90 to be down and to the right. The primary trick I used in r90 to center was (WindowHeight - self.Height) When it comes to r93, It will not scale with the on scale... or what is now called stretch. The other modes seem to be fine... but it looks like the ability to use (WindowHeight) & (WindowWidth) broke in r93

Here are some code examples of what I was doing to center my custom built menus. However, you can duplicate this easily by centering an image every tick in r90/r93 with the following "Heuristic"

I made a menu that was an image put in the middle of the screen with an "Set Position" every tick.

Menu Background image used to be set up like this:

New X Co-Ordinate in Pixels:
((WindowWidth - self.Width)/2) + 400
New Y Co-Ordinate in Pixels:
((WindowHeight - self.Height)/2) + 300

Cursor was setup like this:
New X Co-Ordinate in Pixels:
((WindowWidth - self.Width)/2) + (400 - 419 - 52) + (52 * CursorX)
New Y Co-Ordinate in Pixels:
((WindowHeight - self.Height)/2) + (300 - 483 -52) + (52 * CursorY)

I would Create menu items dynamically like this:
Create object    Inventory_HUD2 on layer "HUD" at ((WindowWidth - Menu.Width)/2) + (52*(MenuArray.CurY+1)) +304, ((WindowHeight - Menu.Height)/2) + (52*(MenuArray.CurX+1)) + 40


If I use r93 and run the game and pull up the menu and start playing around with the windows size it scales funny until I scale it down to the default unstreched size of 800 x 600.

I love Construct! Keep up the good work guys!

Specs:

Windows XP SP3 (Confirmed on my Windows 7 box too)
AMD Radeon HD 6670 w/ Latest Driver
4GB Corsair RAM
Tested with both:
Chrome 19.0.1084.52
Firefox AuroraGillis2012-06-07 05:29:48
Image
B
35
S
13
G
9
Posts: 142
Reputation: 7,340

Post » Thu Jun 07, 2012 3:12 pm

This is by design: due to a breaking change to fix a bug in parallaxing, you can't use WindowWidth/2 and WindowHeight/2 to refer to the middle of the screen any more. The new correct way to do this is the new viewport system expressions:

(ViewportLeft("Layer") + ViewportRight("Layer")) / 2
(ViewportTop("Layer") + ViewportBottom("Layer")) / 2
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Fri Jun 08, 2012 4:07 am

Perfect. That worked. Thanks.
Image
B
35
S
13
G
9
Posts: 142
Reputation: 7,340

Post » Wed Aug 29, 2012 9:53 am

I'm going to try it too. Have the same issue with centering.
B
22
S
7
G
3
Posts: 189
Reputation: 4,270


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests