this post was submitted on 24 May 2024
17 points (100.0% liked)

Godot

5835 readers
22 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

founded 1 year ago
MODERATORS
17
Understanding PopupMenus (programming.dev)
submitted 5 months ago* (last edited 5 months ago) by dai0@programming.dev to c/godot@programming.dev
 

Hi there everyone!

As the title suggests I'm having some problems with PopupMenus and could use a bit of guidance from people more familiar with the engine.

I tried looking through documentation and repo issue discussions but neither of those managed to clear things up for me though it might simply be a case of me being a dumdum. Here's what I'm struggling with:

Issue #1

I'm working on a pixel art title and chose a pretty small screen size as a target (1280x1120 with the scale of 5 so I'm working on 256x224).

Because of this I use font size 11 for most of the text elements but for some reason this does not work well with PopupMenu lists, as options there end up blurry and unreadable.

I read that these elements are scaled somehow differently (or used to anyway) so my question is: is there a way to make it consistent with all the other UI elements? If so, how should I go about it?

Issue #2

I'm adding an optional CRT shader to the game. It works great with both stages and all UI elements except for PopupMenus which simply aren't affected.

Here's my scene setup. CurrentScene is a parent node to the active scene (main menu or one of the stages). I use ZIndex property to draw the CRTShader over other elements.

Any ideas would be greatly appreciated.

Edit: I forgot to mention I'm using Godot 4.3 dev3 and the PopupMenus are automatically created for all OptionButton objects.

Edit #2, in case someone has a similar issue/question: Looks like PopupMenus are rendered as separate windows rather than part of the base one. Writing my own implementation will most likely be the easiest solution to sidestep both issues.

top 4 comments
sorted by: hot top controversial new old
[–] Bougie_Birdie@lemmy.blahaj.zone 2 points 5 months ago (1 children)

I'm still learning Godot myself and haven't used a PopupMenu before, so I'm not sure how much help I can be.

However, regarding Issue #2 at least, I wonder if the issue might be the draw order of your CRT Shader. It's the last node in the scene, and if you move it higher in the hierarchy (or at least above the PopupMenu) you might be able to clear that up. At least, I've had a couple of issues in the past that were resolved that way.

I hope you figure it out, good luck!

[–] dai0@programming.dev 2 points 5 months ago (1 children)

That was actually one of the first thing I tried as well but no dice. I also tried playing with the "Top Level" toggle or any of the Ordering params but neither fixed the issue so far.

Thanks for the idea anyway!

[–] Bougie_Birdie@lemmy.blahaj.zone 2 points 5 months ago (1 children)

Hm, one more thing to think of: are you using any CanvasLayers in the PopupMenu? That could cause the shader to not be rendered on it.

And I guess as a random thing to try, you could duplicate the CRT shader and make it a child of your PopupMenu

[–] dai0@programming.dev 2 points 5 months ago

I don't think so? I should probably mention I'm using Godot 4.3 dev3 and the PopupMenus are created automatically for the OptionButton objects. I don't access their parameters so unless they're somehow automatically bumped above every other UI element they should be at 0.

As for the latter idea it's not really feasible since I have multiple OptionButtons (and PopupMenus created for each of them) so that would require a lot of duplication.