Giter Club home page Giter Club logo

Comments (13)

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024 1

... Reverting the change to createDamageLabel will seem to fix the issue to a point - the numbers still scale wrong. Maybe that was always broken, or it regressed after #9387... Unlikely, the last significant change to ZoomableScrollPane was before that, around the "explored region" feature #8661 ... partial revert reintroducing the pack() call fixes too ... But pack() normally is very wrong for anything participating in a Layout hierarchy, no Widget with a Layout-aware parent should control its own size, that's a breach of contract... OK I start to get it: Stack already breaks that contract by sizing itself by default to 150x150 units - and I replaced the ShadowedLabel design late in its genesis from a generic WidgetGroup with much more glue code to the shorter Stack since all that glue logic turned out to be the same. Seemingly. My bad for testing that use early and not retesting after """simplification"""...

For laughs, here's the culprit:
https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Stack.java#L47

Any legitimate use of Stack must overwrite these values, and ShadowedLabel, trying to be nice to the Layout interface, doesn't. In the other use it has a parent that controls its size normally...

So the fix is... one pack(), which does not need the old setSize after it because ShadowedLabel implements Layout and includes the displacement in its reported prefSizes... But I'm not yet sure where to place it.

@prod0ad - thanks for the report, and sorry again I misunderstood. I read "the red text is applied a second time, in black/dark grey and a bit displaced" and immediately thought "but of course it's a bit displaced, that's the whole point of a shadow, I remember investing that effort because without a shadow they looked cr... - not so nice on some terrains, especially some mods with very reddish ones"...

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024 1

oldschool game pics

It's pretty much Xmas! Shattered pixel's rat king already has a nifty santa hat! (And no you can't get it by giving him the other crown)

from unciv.

yairm210 avatar yairm210 commented on September 27, 2024

Can you add a screenshot?
@SomeTroglodyte sounds like shadowed text

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024

Strange. I'm sure I wrapped that in a ShadowedLabel class. But in my master it's still done explicitly in BattleTableHelpers Line 215. So, yes, there's a shadow:
image
Nasty bug, that...

from unciv.

prod0ad avatar prod0ad commented on September 27, 2024

Just uploaded screenshot, was kinda hard to time correctly:p

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024

Oh no - no damage label at all anymore:
image

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024

Ah, there it is - just needed to pull a fresh master. ShadowedLabel in the widgets package, used in BattleTableHelpers and that yarn legend. And it shows!:
image

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024

Ah now I see it - that far displaced. No, displacement should only be 1 logical world coord unit. So - which mods, including permanent visual ones? Which Linux? Graphics layer? Which Java? Display settings?

from unciv.

prod0ad avatar prod0ad commented on September 27, 2024

Ah now I see it - that far displaced. No, displacement should only be 1 logical world coord unit. So - which mods, including permanent visual ones? Which Linux? Graphics layer? Which Java? Display settings?

Mods: Invalid. Happens even when I disable my mod, the border mod and play the base game.
Linux: Devuan Beowolf
Graphics: GeForce GT 1030, NVIDIA Driver Version:418.181.07
Java: openjdk version "11.0.11" 2021-04-20
Display: 1600 x 900 60hz

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024

Sorry for the nagging - I was expecting something unusual, something out of place (a 4.x kernel is a bit unusual nowadays but not the issue here) - but it reproduces on vanilla and current master here. So, the wrapping of the older shadow code in that ShadowedLabel went wrong. Not only that, the size and placement is also way off from what was intended. It seems the numbers get larger when zooming out instead of smaller...

This may have some correlation with an experiment I did lately - I tried painting something in Screen.render floating over a MapHolder to mirror position and size of a specific tile - I failed utterly, after several days of trying. localToStageCoordinates is simply wrong. But that damage label - what is its parent?? 🤔

from unciv.

prod0ad avatar prod0ad commented on September 27, 2024

Np and thank for working to fix this. I got a bit confused though with the oldschool game pics and the technicalities:)

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on September 27, 2024

technicalities

Always. This is a technical environment after all 🤪. To add to it: The nicest solution was not a pack() call after all, the ShadowedLabel simply undoes Stack's unsavoury default 150x150 sizing with better values than before - it already had the setSize call and the size a pack() would set readily available.

Nice profile pic by the way.

from unciv.

prod0ad avatar prod0ad commented on September 27, 2024

Nice profile pic by the way.

Credit to Unciv/Hexarealm and Fairline/Tanelorn units for Civ2 mods.

from unciv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.