glfw-net
glfw-net copied to clipboard
Glfw.GetKeyName(Keys key, int scanCode) throws internal exception when used with non-printable key
Glfw.GetKeyName(Keys key, int scanCode) throws an internal NullReferenceException when specifying a key that is non-printable (eg. Keys.LeftControl). Description states the method returnes null instead. To fix this, changing
public static string GetKeyName(Keys key, int scanCode)
{
return Util.PtrToStringUTF8(GetKeyNameInternal(key, scanCode));
}
to
public static string GetKeyName(Keys key, int scanCode)
{
IntPtr ptr = GetKeyNameInternal(key, scanCode);
return ptr == IntPtr.Zero? null : Util.PtrToStringUTF8(ptr);
}
should probably do the trick.
Side note: what are the plans on releasing the current/corrected version to nuget?
Thanks, will fix that too,
Am finally working on this again right now (literally).
Awesome! Allow me to thank you for all the time you put into this - making bindings is a pain (I am one to talk, you would know xD), so this makes a lot of peoples life significantly easier. We appreciate it!