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

Engine: refactor passing text_color into display_main() #2649

Merged

Conversation

ivan-mogilko
Copy link
Contributor

@ivan-mogilko ivan-mogilko commented Jan 10, 2025

  • Replaced DISPLAYTEXT_x macros with DisplayTextType enum;
  • Got rid of confusing asspch parameter which combines text color with the "text style" by applying a sign. Instead have separate text_color and a style parameter of DisplayTextStyle enum.
  • Also added DisplayTextShrink enum for the allow_shrink parameter.
  • Grouped them into DisplayTextLooks struct.

@ivan-mogilko ivan-mogilko added the context: code fixing/improving existing code: refactor, optimise, tidy... label Jan 10, 2025
@ericoporto
Copy link
Member

ericoporto commented Jan 11, 2025

Great work! The display stuff is one of the parts of the engine where there is still a lot of cruft from the original code so this refactor looks great.

I think in similar fashion, only aschar rename to char_id and allowShrink being made an enum (with a rename?) would be things in similar changes I would make to this code. Obviously not necessary here just they are things I noticed when looking the code adjacent to the git diff one in the web interface.

@ivan-mogilko
Copy link
Contributor Author

ivan-mogilko commented Jan 11, 2025

Changed to another variant, with enums and a struct to group them instead of flags.

Found and fixed one case when overlay was passing a negative color value to force certain style....

@ericoporto
Copy link
Member

I tested this with a few of my own test games and also the shivah, and afaict all is still working alright.

@ivan-mogilko ivan-mogilko merged commit 35e36ae into adventuregamestudio:master Jan 11, 2025
21 checks passed
@ivan-mogilko ivan-mogilko deleted the 362--refactor-asspch branch January 11, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context: code fixing/improving existing code: refactor, optimise, tidy...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants