nonworking dynamic bindings
This commit is contained in:
parent
2335c5275f
commit
790ff3fcf6
8 changed files with 119 additions and 31 deletions
|
@ -2,33 +2,9 @@ __version__ = "2.5.dev1"
|
|||
|
||||
from ._raylib_cffi import ffi, lib as rl
|
||||
from _raylib_cffi.lib import *
|
||||
from .colors import *
|
||||
from .helpers import *
|
||||
|
||||
|
||||
|
||||
def Vector3(x, y, z):
|
||||
return ffi.new("struct Vector3 *", [x, y, z])[0]
|
||||
|
||||
LIGHTGRAY =( 200, 200, 200, 255 )
|
||||
GRAY =( 130, 130, 130, 255 )
|
||||
DARKGRAY =( 80, 80, 80, 255 )
|
||||
YELLOW =( 253, 249, 0, 255 )
|
||||
GOLD =( 255, 203, 0, 255 )
|
||||
ORANGE =( 255, 161, 0, 255 )
|
||||
PINK =( 255, 109, 194, 255 )
|
||||
RED =( 230, 41, 55, 255 )
|
||||
MAROON =( 190, 33, 55, 255 )
|
||||
GREEN =( 0, 228, 48, 255 )
|
||||
LIME =( 0, 158, 47, 255 )
|
||||
DARKGREEN =( 0, 117, 44, 255 )
|
||||
SKYBLUE =( 102, 191, 255, 255 )
|
||||
BLUE =( 0, 121, 241, 255 )
|
||||
DARKBLUE =( 0, 82, 172, 255 )
|
||||
PURPLE =( 200, 122, 255, 255 )
|
||||
VIOLET =( 135, 60, 190, 255 )
|
||||
DARKPURPLE =( 112, 31, 126, 255 )
|
||||
BEIGE =( 211, 176, 131, 255 )
|
||||
BROWN =( 127, 106, 79, 255 )
|
||||
DARKBROWN =( 76, 63, 47, 255 )
|
||||
WHITE =( 255, 255, 255, 255 )
|
||||
BLACK =( 0, 0, 0, 255 )
|
||||
BLANK =( 0, 0, 0, 0 )
|
||||
MAGENTA =( 255, 0, 255, 255 )
|
||||
RAYWHITE =( 245, 245, 245, 255 )
|
26
raylib/colors.py
Normal file
26
raylib/colors.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
LIGHTGRAY =( 200, 200, 200, 255 )
|
||||
GRAY =( 130, 130, 130, 255 )
|
||||
DARKGRAY =( 80, 80, 80, 255 )
|
||||
YELLOW =( 253, 249, 0, 255 )
|
||||
GOLD =( 255, 203, 0, 255 )
|
||||
ORANGE =( 255, 161, 0, 255 )
|
||||
PINK =( 255, 109, 194, 255 )
|
||||
RED =( 230, 41, 55, 255 )
|
||||
MAROON =( 190, 33, 55, 255 )
|
||||
GREEN =( 0, 228, 48, 255 )
|
||||
LIME =( 0, 158, 47, 255 )
|
||||
DARKGREEN =( 0, 117, 44, 255 )
|
||||
SKYBLUE =( 102, 191, 255, 255 )
|
||||
BLUE =( 0, 121, 241, 255 )
|
||||
DARKBLUE =( 0, 82, 172, 255 )
|
||||
PURPLE =( 200, 122, 255, 255 )
|
||||
VIOLET =( 135, 60, 190, 255 )
|
||||
DARKPURPLE =( 112, 31, 126, 255 )
|
||||
BEIGE =( 211, 176, 131, 255 )
|
||||
BROWN =( 127, 106, 79, 255 )
|
||||
DARKBROWN =( 76, 63, 47, 255 )
|
||||
WHITE =( 255, 255, 255, 255 )
|
||||
BLACK =( 0, 0, 0, 255 )
|
||||
BLANK =( 0, 0, 0, 0 )
|
||||
MAGENTA =( 255, 0, 255, 255 )
|
||||
RAYWHITE =( 245, 245, 245, 255 )
|
15
raylib/dynamic_binding/__init__.py
Normal file
15
raylib/dynamic_binding/__init__.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
"""
|
||||
This is an attempt at a CFFI dynamic (ABI) binding. However, it fails to work in the exactly same place the ctypes binding fails, accessing
|
||||
materials of a model.
|
||||
"""
|
||||
|
||||
|
||||
import pathlib
|
||||
MODULE = pathlib.Path(__file__).parent.parent
|
||||
|
||||
from cffi import FFI
|
||||
ffi = FFI()
|
||||
ffi.cdef(open(MODULE / "raylib_modified.h").read().replace('RLAPI ', ''))
|
||||
|
||||
raylib = ffi.dlopen(str(MODULE)+"/dynamic_binding/libraylib.2.dylib")
|
||||
|
BIN
raylib/dynamic_binding/libraylib.2.dylib
Executable file
BIN
raylib/dynamic_binding/libraylib.2.dylib
Executable file
Binary file not shown.
5
raylib/helpers.py
Normal file
5
raylib/helpers.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from ._raylib_cffi import ffi
|
||||
|
||||
def Vector3(x, y, z):
|
||||
return ffi.new("struct Vector3 *", [x, y, z])[0]
|
||||
|
Reference in a new issue