HUD scale rate issue

Discussion and feedback on Construct 2

Post » Tue Dec 16, 2014 12:34 am

Hello guys,

I'm working on a project for desktop and mobile, and I want some HUD elements to always keep the same size, on any device and with any screen size. For example, the text must stay readable on mobile devices, without getting too big on desktop.

I read hundreds of times the well-known tutorial "Supporting multiple screen sizes" (https://www.scirra.com/tutorials/73/supporting-multiple-screen-sizes/page-2) but when I try to set my HUD layer's scale rate to 0 to prevent the text from scaling with the game, it just doesn't work : The buttons shrink when I resize the window, and everything is unreadable...

Can you help me please ?


PS : English is not my mother tongue, so please correct me if I make mistakes or can't make myself clear
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Post » Tue Dec 16, 2014 3:16 am

I'm having this kind of trouble too, I really can't figure out how to solve it... So please guys help us !
B
24
S
5
Posts: 42
Reputation: 1,286

Post » Tue Dec 16, 2014 1:55 pm

The problem is most likely the difference in PPI between mobile and PCs. As you probably know, the size of the text/sprites is measured in pixels. However, the number of pixels per inch is monstrously different between the two platforms, ie. my laptop computer has a resolution of 1280 x 800 on a 13" screen, while my Samsung Galaxy Tab S has 2560 x 1600 pixels on a 10.5" screen.

One solution would be to have an event "On Start of Layout" with the action HUDElement > Set Size (insert something like the device's PPI * the desired width in inches, & the same thing for the height) combined with the anchor behavior.

The device's PPI might be derived from an expression similar to "System.WindowWidth / System.OriginalWindowWidth".
B
19
S
3
G
1
Posts: 29
Reputation: 1,038

Post » Tue Dec 16, 2014 2:55 pm

Thank you for your quick reply
I'm not sure your solution will solve the problem, because the HUD scales with the game, when I resize the window on my computer : the game is always displayed on the same screen, I just resize my browser's window, but the screen's PPI doesn't change...

Edit : I tried your solution just in case, but I was right it doesn't works
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Post » Tue Dec 16, 2014 7:26 pm

Are vegapomme27 and I the only ones having issues with this feature, or do the other Construct 2 users have to create a game template for smartphones and another for computers ?

Does anyone have an example of .capx file where the HUD doesn't scale with the rest of the game ?
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Post » Sat Dec 20, 2014 3:39 am

Ratmaster wrote:Are vegapomme27 and I the only ones having issues with this feature, or do the other Construct 2 users have to create a game template for smartphones and another for computers ?

Does anyone have an example of .capx file where the HUD doesn't scale with the rest of the game ?



@ratmaster

No you aren't the only one having this issue. I've run into the same problem. For me, at least I think multiple template is the only answer. If I figure it out, I'll let you know.
B
8
S
2
G
1
Posts: 47
Reputation: 653

Post » Sat Dec 20, 2014 9:40 am

Thanks flatness :D , same here
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573


Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 16 guests