Skip to content

Commit df82e9b

Browse files
committed
pyRay : had to use some dynamic type comparison
1 parent 422b290 commit df82e9b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pyray/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1414

1515
from raylib import rl, ffi
16+
from ctypes import c_int, c_float, c_double, c_uint
1617
from inspect import ismethod,getmembers,isbuiltin
1718
import inflection
1819

@@ -70,11 +71,13 @@ def to_str(value):
7071
return ffi.string(value).decode('utf-8')
7172

7273
def to_pointer(value):
73-
return ffi.addressof(value)
74+
if str(type(value)) == "<class '_cffi_backend.__CDataOwn'>":
75+
return ffi.addressof(value)
76+
return value
7477

7578

7679
def makeFunc(c_func):
77-
#print("makefunc ",a, ffi.typeof(a).args)
80+
#print("makefunc ", c_func, ffi.typeof(c_func).args)
7881

7982
# based on ctypes of arguments of the c function
8083
# we build a list of converters to call on python function arguments

0 commit comments

Comments
 (0)