terrarium-earth / Heracles

A tree style questing mod allowing creators to set completable quests for their users
MIT License
35 stars 19 forks source link

Fix dependency line coords #127

Closed SubordinalBlue closed 1 year ago

SubordinalBlue commented 1 year ago

Dependency lines were not actually aligned with the centers of quest icons. Default arrow.png is 3x5, and quest icons are 24x24... so offset to center is +10.5f, +9.5f. [Edit: actual correct values are 10, 10; see comment below.]

Before: image

After: image

SubordinalBlue commented 1 year ago

Looking real hard at these, I see there's an underlying issue preventing true perfect alignment: the arrow texture the dep. lines are painted with has odd numbered dimensions, while the quest icon backgrounds have even numbered side lengths.

It's very close though, after this micro-patch

[edit: removed musings on the worth of potential future improvements; would be out of scope of this PR]

sisby-folk commented 1 year ago

The use of the .5 offsets seems to deform the arrrow texture - you can see it's no longer symmetrical. The x was off by more than one though, so I think either just swap that to 10, or consider messing with the arrow.

SubordinalBlue commented 1 year ago

Big think-o on my math there. Added 0.5 to y and took away 0.5 from x. Correct offsets are 10, 10.

2023-11-04_12 56 37 copy

sisby-folk commented 1 year ago

ah of course! because the backgrounds are 2x you have the freedom to align it to the centre. looks good!

we'll have to see if we can make them less stretched along the length of the arrow so it has square pixels and doesn't break down on 1x at some point, if that's something that interests you.

SubordinalBlue commented 1 year ago

Was going to add an explanation of my math but, tbh, what made sense in my head and prompted the correction in the second commit doesn't quite any more when I work through it on paper, at least for the y offset. Surely there are factors to consider outside the 'pure' math, as Sisby-folk pointed out.

Here are large magnifications of my test screen shot with the editor programs grid visible. This observationally feels like the right answer.

image

image