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

Fonts Unchained: decoupling font classes #42520

Merged
merged 8 commits into from
Aug 18, 2020

Conversation

barsoosayque
Copy link
Contributor

Summary

SUMMARY: Infrastructure "Decouple Font classes and Font rendering in SDL related code"

Purpose of change

Continuation of work on fixing I-am-Erk/CDDA-Tilesets#133 (previous PR: #42227). I need this so I can pass fonts to cata_tiles and render some symbols there.
And as always, making rendering code more independent.

Describe the solution

Mostly copy-paste from sdltiles.cpp into sdl_font.h / sdl_font.cpp. I haven't changed any logic in Font classes. Cleaned things up a little, used new GeometryRenderer instead of old static functions.

Describe alternatives you've considered

Possibly, merge SDL_Renderer_Ptr& and GeomentryRenderer_Ptr together in some sort of Renderer_Ptr which is capable of rendering everything. But the PR is big enough already.

Getting rid of statics fontwidth and fontheight, but they are tricky and also out of scope for this PR.

Testing

Loaded up the game, hud renders fine, inventory and crafting menu renders fine. Overmap also renders fine.
Changed font settings, restarted the game, tried everything again, no problems.
Run rendering benchmark: no performance decrease there either.

Additional context

Honestly, I expected it to be much more painful than it was. And I'm not 100% that my test have absolute coverage, but I can't think of other places to test.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style SDL: Tiles / Sound Tiles visual interface and sounds. labels Jul 28, 2020
@ZhilkinSerg ZhilkinSerg self-assigned this Aug 3, 2020
src/sdltiles.cpp Outdated Show resolved Hide resolved
src/sdltiles.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style SDL: Tiles / Sound Tiles visual interface and sounds.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants