[Rewrite] Implement byte -> bool marshalling
Since GL_TRUE and GL_FALSE match .Net true and false (1 and 0, respectively), we can simply reinterpret the byte value as a bool. In the future, we could issue a `(if value == 0 then false else true)` statement for added safety, but this does not appear to be necessary right now.
This commit is contained in:
parent
92efb5957f
commit
c7c3e3b69b
1 changed files with 8 additions and 0 deletions
|
@ -497,6 +497,14 @@ namespace OpenTK.Rewrite
|
|||
{
|
||||
// Nothing to do
|
||||
}
|
||||
else if (wrapper.ReturnType.Name == "Boolean" && native.ReturnType.Name == "Byte")
|
||||
{
|
||||
// Nothing to do
|
||||
// It appears that a byte with 1 = true (GL_TRUE) and 0 = false (GL_FALSE)
|
||||
// can be reinterpreted as a bool without a problem.
|
||||
// Todo: maybe we should return (value == 0 ? false : true) just to be
|
||||
// on the safe side?
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine("Return wrapper for '{1}' not implemented yet ({0})", native.Name, wrapper.ReturnType.Name);
|
||||
|
|
Loading…
Reference in a new issue