[Feature] Add a string method for `OpenURL` and `SetGamepadMappings`
See original GitHub issueBefore 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.
Issue Analytics
- State:
- Created 2 months ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
[core] Add function to update gamepad mappings #1506
I was thinking naming it SetGamepadMappings or UpdateGamepadMappings . Code Example. RLAPI int SetGamepadMappings(const char *mappings); ...
Read more >raylib.h - raysan5
A simple and easy-to-use library to enjoy videogames programming - raylib/src/raylib.h at master · raysan5/raylib.
Read more >raylib - cheatsheet
raylib is a simple and easy-to-use library to enjoy videogames programming. Don't miss latest functions added to raylib... check raylib cheatsheet.
Read more >2 Generated Raylib Bindings
Encode text as codepoints array into UTF-8 text string (WARNING: memory must be freed!) procedure. ( ...
Read more >rl
Package raylib - Go bindings for raylib, a simple and easy-to-use library to learn videogames programming.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
Merged: https://github.com/ChrisDill/Raylib-cs/pull/180