openplanet-nl / issues

Issue tracker for Openplanet.
10 stars 0 forks source link

format code issues: `$i`, `$t`, `$w`, `$n`, `$o` #457

Closed XertroV closed 3 months ago

XertroV commented 5 months ago

expected behavior is going by https://wiki.trackmania.io/en/content-creation/text-styling

\\$i prints i (expected: nothing or italics) \\$t consumes the next character (tested 1 and x and expected 1 and X) -- should force uppercase \\$w prints w (expected: nothing or wide text) \\$n prints n (expected: nothing or narrow text) \\$o prints o (expected: nothing or bold)

Note: i think the wiki incorrectly says that $$ should print $$, but as an escape it should obviously print $.

codecat commented 3 months ago

In Openplanet, \$tXX changes the transparency of the text, as an Openplanet-specific feature. This stems from before Trackmania had this formatting option. As this conflicts, I've changed it to \$jXX (it wasn't really being used anywhere, and $j appears unused by the game).

I've also added support for \$i.

image

if (UI::Begin("Test")) {
    UI::Text("Normal");
    UI::Text("\\$f00Red");
    UI::Text("\\$iItalics");
    UI::Text("\\$tUppercase");
    UI::Text("\\$wWide");
    UI::Text("\\$nNarrow");
    UI::Text("\\$oBold");
}
UI::End();

The rest will remain unsupported due to how the way we do formatting in ImGui, but they will consume the character as expected.