Skip to content

Commit 11c5b1a

Browse files
use typedefs when constructing structs
1 parent d3fcb40 commit 11c5b1a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pyray/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def func(*args):
126126
or isinstance(arg, (array, bytes, bytearray, memoryview)))):
127127
arg = ffi.from_buffer(field[1].type, arg)
128128
modified_args.append(arg)
129-
s = ffi.new(f"struct {struct} *", modified_args)[0]
129+
s = ffi.new(f"{struct} *", modified_args)[0]
130130
global_weakkeydict[s] = modified_args
131131
return s
132132

tests/test_pyray.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
pr.init_window(800, 450, "Raylib texture test")
88
pr.set_target_fps(60)
99

10+
test_typedef_init = pr.Texture2D() # Texture2D is typedef for Texture
11+
1012
image = pr.gen_image_color(800, 400, (0,0,0,255) )
1113
texture = pr.load_texture_from_image(image)
1214
pr.update_texture(texture, image.data)

0 commit comments

Comments
 (0)