-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly center the SDL ASCII lines #71351
Conversation
failed check seems to be a max item density error ? which is definitely unrelated |
whee futureproofing
i implemented the function @Qrox suggested and tested it with the default and thicker lines at 9x17 and 8x16 font dimensions, and everything worked as intended where the lines are either perfectly centered (odd on odd, even on even) or centered on the upper or leftest of the two possible middle pixels (odd on even, even on odd) |
0617710
to
d0de000
Compare
d0de000
to
b42c3b8
Compare
* correctly center the sdl lines * better function whee futureproofing
Summary
Bugfixes "Fixes SDL ASCII lines being uncentered"
Purpose of change
The SDL ASCII lines were off center by a pixel because the function that draws them didn't account for line thickness.
Describe the solution
Subtracting the line thickness from the width before dividing it by 2 so that regardless of line thickness or font dimensions everything stays centered. This also conveniently makes them line up with lots of stuff in Terminus (except for the fact that they're thick lines on the vertical so they don't match the thin line verticals of Terminus and most fonts but that's mostly intended behavior as far as I'm aware)
Describe alternatives you've considered
Not doing this. I also considered adding some code that circumvents the line drawing stuff and just uses the correct unicode characters for the menu borders and stuff, unless the font width or height is different from the font height and width itself (so that if you say make an 8x16 font fit an 16x16 space the lines still connect correctly), but I'm not sure exactly where that check would need to be. There's also the Extra fancy option of looking at the edges of the box drawing characters in the current font to generate automatically resizing versions (to perfectly dynamically solve the 8x16 to 16x16 thing) but that's a lot of effort for a very small effect.
Testing
Built the game and looked at various situations where SDL lines are used and everything looked good.
Additional context
Before:



After:


