Incorrect label position

#1

Does anyone know why my text labels are not being scaled or positioned correctly when my game is not full-screen? I have an entry object that consists of a sprite (colored box) and a label (name of a person). When the app is viewed full-screen, the game object is rendered correctly. But, if the game is not full-screen, the game-object is “almost” rendered correctly. The colored box is positioned correctly, but the text is not.

This would not be an issue except that many full-hd laptop displays are usually scaled up by default so people can see the UI. This is causing some issues for my users since they are having to change their display settings to disable to scaling.

I have also tried to resolve this by creating the HTML5 build of the game, but am still having the same issues.

Thank you for any insight and tips.

David

0 Likes

#2

We would need to see a sample to know what is going wrong. Maybe it’s that you need to enable high dpi in game.project.

0 Likes

#3

The first image is game at full-screen. The labels are positioned correctly.
The second image is windowed and scaled down slightly. The labels are not scaled and positioned to the right.

0 Likes

#4

Does it matter if I am using labels in a GO or GUI? The reason I did not use a GUI is because I have a help screen GUI that pops up when the user presses “?”.

0 Likes

#5

You should look at Monarch for popup management.

What material do you have set for your labels here? It’s still not clear so you’ll need to post a sample, can you make a minimal version of this issue to upload here as a zip?

0 Likes

#6

Will do.

0 Likes

#7

I’ve posted the source code on Github at https://github.com/davidoshiro/Wheel-bad-labels

0 Likes

#8

The GUI text labels do in fact scale with the window. For some reason, my game object that displays the names does scale except for the text label. That is extremely strange as not only does the size of the text label not change with the window size, the position of the text label also does not change with the window size. I doubt that this behavior is a feature since I cannot imagine an app where the text labels do not scale with the app.

I’m not sure how to proceed since the game objects are created via a factory and this is not possible with the gui.

Any help would be appreciated.

David

0 Likes

#9

0 Likes

#10

Whoa, a bit of deja vu on this project, haha, welcome back.

The issue is on the label in your “entry.go” you have its material set to: “/builtins/fonts/font-df.material”, and if you open up that material and scroll down to look at its tags, it’s under “gui”. So it will be rendered in screen space instead of world space. (But won’t be scaled like a GUI because it’s a label component). The material it should have is: “/builtins/fonts/label-df.material”.

By the way you can create GUI nodes at runtime, with gui.clone, gui.clone_tree, gui.new_text_node, etc. See the API doc.

3 Likes

#11

Holy Schnitzel! @ross.grams you are a life saver! Damn! I figured it was a configuration issue, but totally overlooked the material! Not sure why someone would use font-df.material, but your suggestion just solved my issue! Awesome!

Thank you and the rest of the community for being awesome!

David

2 Likes