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

Allow pack devs to specify font and font size for messages #379

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

Bauumm
Copy link
Contributor

@Bauumm Bauumm commented Sep 9, 2022

This is again a change for 1.92 parity so I can use the old font and size messages accordingly, so it doesn't look broken. Additionally custom fonts probably allow for some interesting new effects in levels too.

Copy link
Owner

@vittorioromeo vittorioromeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for the PR! I am happy to add the feature. A few things:

  1. See inline comments.

  2. Testing! Have you tested this? Have you tested that the font and font size is correctly restored after reset or changing levels? Have you tested what happens when the user tries to load an invalid font or uses something like a negative font size? Please also add a test Lua level to this PR.

@@ -205,6 +205,7 @@ class HexagonGame
std::optional<SwapParticleSpawnInfo> swapParticlesSpawnInfo;
float nextPBParticleSpawn{0.f};
float pbTextGrowth{0.f};
float messageTextCharacterSize{32.f};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This likely needs to be reset between levels or even between resets of the same level. Maybe make it part of HGStatus? That should get reset automatically.

@@ -169,6 +169,21 @@ void HexagonGame::initLua_Utils()
.doc(
"Force-swaps (180 degrees) the player when invoked. If `$0` is "
"`true`, the swap sound will be played.");

addLuaFn(lua, "u_setMessageFont", //
[this](std::string mFontId) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[this](std::string mFontId) {
[this](const std::string& mFontId) {

addLuaFn(lua, "u_setMessageFont", //
[this](std::string mFontId) {
messageText.setFont(
assets.getFontOrNullFont(getPackId() + "_" + mFontId));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can use the concat utility here to create the final string.

@Bauumm
Copy link
Contributor Author

Bauumm commented Sep 10, 2022

I have tested loading invalid fonts, it just displays a dot in place of the message. Setting the font size to a negative value seems to make the message invisible.

@Morxemplum
Copy link
Collaborator

As much as I love to see the enthusiasm for 1.92 compatibility, there is a good reason why Imagine (the 1.92 font) was ditched. It was done so for licensing purposes, as we had to change to another font if Vee wanted to sell the game on Steam.

It was temporarily Forced Square, but due to the limited character set and the inability to modify that font directly, is what lead me to create the game's current font Open Square. I understand that some people like the look of Imagine, but unless someone is willing to buy the license, then you'll be running into the same copyright dilemma that pack developers already have to deal with when it comes to music.

Just my two cents on this.

@Bauumm
Copy link
Contributor Author

Bauumm commented Sep 10, 2022

Well if I understand the issue correctly, the font could not be included with the game as it is commercial. However shouldn't it be possible to include the font in non-commercial level packs?

@Morxemplum
Copy link
Collaborator

I am not a legal expert, so I can't answer that question. You got that first sentence right.

@Bauumm Bauumm changed the base branch from master to develop October 1, 2022 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants