mirror of
https://github.com/AntonioND/nitro-engine.git
synced 2025-06-18 16:45:33 -04:00
![]() The goal of the changes made in this PR is to create something with this effect ("Jonko" is in in green, the rest is in white): "Dear god." Jonko quickly replied, crestfallen. In order to do this, I need to call `NE_RichTextRender3D` or `NE_RichTextRender3DAlpha` three times: once to draw the first part of the sentence with the white font, once to draw "Jonko" in turquoise, and once to draw the remainder of the sentence in white again. In order to ensure that text is being drawn in the correct location, I need the position where the previous call stopped drawing, which leads to the first change this PR makes: I have added a version of `DSF_StringRenderDryRun` which accepts pointers to `final_x` and `final_y` and stores the last position of `font->pointer_x` and `font->pointer_y` in them and I have added a new variant of `NE_RichTextRenderDryRun` called `NE_RichTextRenderDryRunWithPos` which uses that DSF function and has analogous parameters. These functions get us the position where we need to place the next cursor, but the next issue is that currently NitroEngine and libDSF only allow for specifying the position of the overall box to draw text in, but not where to offset the cursor in that box. This leads to the following problem ("Jonko" is in in green, the rest is in white): "Dear god." Jonko quickly replied, crestfallen. Thus, the second change: I have introduced new versions of `DSF_StringRender3D` and `DSF_StringRender3DAlpha` which accept an `xStart` position that is added to the `pointerX`. Correspondingly, I have added versions of `NE_RichTextRender3D` and `NE_RichTextRender3DAlpha` that use these new functions as well. Let me know if there are any issues with how I've written this (C is not my forte, after all), but the first screenshot is this being tested in production code. |
||
---|---|---|
.. | ||
dsf.c | ||
dsf.h |