[SOLVED] Window Width Problem

Bugs will be moved here once resolved.

Post » Sat Jul 07, 2012 3:34 pm

Hi there

Here's a capx for something I've been working on:

[solved]

I've got a problem in that the WindowWidth expression appears to be giving me an incorrect value - either that, or something has gone wrong with events and I cannot figure out what. Can anyone see what has gone wrong here?

Reproduced it here, and it's only apparent when the window gets quite thin:

https://dl.dropbox.com/u/1378330/WindowWidthProblem2.capxcow_trix2012-07-08 03:36:31
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Sat Jul 07, 2012 3:45 pm

Strange, it's giving me correct values. What is the size of the screen, and what value are you getting?

Edit: I use Chrome by the wayNimtrix2012-07-07 15:46:35
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jul 07, 2012 3:54 pm

Sorry, I should really have been clearer. I believe the actual values displayed are correct. HOWEVER, the sprites do not resize properly - the action should resize their width to the width of the window, but it does not do it properly.

I believe it probably has something to do with the Fullscreen setting, which is set to Scale.
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Sat Jul 07, 2012 4:24 pm

Hmm, sprites resize properly as well in my browser. Made the text return Sprite.Width and it also returns the expected value. Maybe it's a problem with the graphics card driver, have you tried updating?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jul 07, 2012 4:28 pm

Hi Nimtrix. Good idea. I've updated the second example to do just that. The sprite does appear to be saying that it's width is equal to the window width. However, this is evidently not the case for me, as you can see here:

https://dl.dropbox.com/u/1378330/WindowWidthscreenshot.jpg
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Sat Jul 07, 2012 6:03 pm

It's not a bug - the window width is not related to the viewport width. You meant the viewport width, but sized it to the window width which does not take in to account the scale. Instead, use the expression:
ViewportRight("Layer 0") - ViewportLeft("Layer 0")
Then the sprite perfectly sizes with the window, and if you update the 2nd example you'll see the values reported are different, even though it's working correctly.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Jul 08, 2012 3:37 am

Thanks Ash! That was it.
B
55
S
12
G
8
Posts: 339
Reputation: 9,314


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest