I am using SDL to render graphics like lines and pixels using C#. I have to display some text on screen as well. I haven't found any resource on this topic on the internet. Most of the code that I wrote is translated from C++. Now I need to render text and I am not able to translate its C++ implementation into C# since the classes used are not seem to be available in C#.
I have found this great C++ implementation for rendering text: https://stackoverflow.com/a/22889483/574917
I need to know how to do this in C#.
Code sample is highly appreciated.
SDL2-CS is a good wrapper for SDL with TTF:
https://github.com/flibitijibibo/SDL2-CS
The implementation you gave would be implemented like this:
Note that instead of
struct*the library usesnintto represent pointers which won't require theunsafekeyword.If you're looking for a different SDL library with TTF support, then sdlsharp (https://github.com/plunch/sdlsharp) is a good alternative.