Skip to content
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

Code clearing window was using global font instead of the font actual… #72127

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

MBlueD
Copy link
Contributor

@MBlueD MBlueD commented Mar 2, 2024

…ly passed to draw_window

Summary

Bugfixes "Fix for ASCII terrain not clearing window correctly when using map font dimensions different than the global font"

Purpose of change

I play in ASCII mode and after recent updates I noticed incorrect visual artifacts in unexplored areas in the half of the window to the right of my character. For example, if I open the map then close it, unexplored tiles in the affected area would still show the content from the map.

After some investigation it turns out that the code that draws the window is clearing it using global font dimensions, and because I was using a map font with double the width of the global font, only half my terrain window was being cleared correctly. Setting my map font to the same dimensions as the global font hides this problem.

To reproduce, start in ASCII mode with a map font that has dimensions different to the global font (a width or height that is twice the global highlights the problem quite well). Open the map and close it to see the problem.

The issue does not happen when using tiles as far as I could see.

Describe the solution

Modified the code to calculate clear rectangle based on the font passed to the draw_window method.

Describe alternatives you've considered

None.

Testing

Manual testing to verify fix.

Additional context

None.

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` new contributor <Bugfix> This is a fix for a bug (or closes open issue) labels Mar 2, 2024
src/sdltiles.cpp Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Mar 3, 2024
@dseguin dseguin merged commit 053ee0d into CleverRaven:master Mar 6, 2024
21 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions new contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants