[Feature] Add a string method for `OpenURL` and `SetGamepadMappings`
MrScautHD opened this issue · comments
Before submitting a new issue, please verify and check:
- The issue is specific to Raylib-cs and not raylib
- I checked there is no similar issue already reported
- My code has no errors or misuse of Raylib-cs
Issue description
Hello, i saw by the methods OpenURL
and SetGamepadMappings
that there is just a method that takes sbyte*
i would suggest to do a second method with a string value.
And i found another thing, you could use instead of try/finally:
You use:
public static unsafe int MeasureText(string text, int fontSize)
{
UTF8Buffer utF8Buffer = text.ToUTF8Buffer();
try
{
return Raylib.MeasureText(utF8Buffer.AsPointer(), fontSize);
}
finally
{
utF8Buffer.Dispose();
}
}
What i suggest:
public static unsafe int MeasureText(string text, int fontSize)
{
using (UTF8Buffer buffer = text.ToUTF8Buffer())
{
return Raylib.MeasureText(buffer.AsPointer(), fontSize);
}
}
What i suggest (smallest):
public static unsafe int MeasureText(string text, int fontSize) {
using UTF8Buffer buffer = text.ToUTF8Buffer();
return Raylib.MeasureText(buffer.AsPointer(), fontSize);
}
That would Dispose it to and it would smaller.
Let me know if you like my idea so i doing a PR.
We are more then happy to accept pull requests, though we already use your suggested method:
https://github.com/ChrisDill/Raylib-cs/blob/master/Raylib-cs/types/Raylib.Utils.cs#L886
We are more then happy to accept pull requests, though we already use your suggested method:
https://github.com/ChrisDill/Raylib-cs/blob/master/Raylib-cs/types/Raylib.Utils.cs#L886
ohhh, if i download it on nuget it doing it like that.... lol
I wanna create laiter a pull for the string value