Use the new buffer method to create ctypes arrays.

This commit is contained in:
Roz K 2022-12-23 10:24:21 +01:00
parent 858dcd95bc
commit 34277274a3
Signed by: roz
GPG Key ID: 51FBF4E483E1C822
1 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@
from ctypes import c_ubyte, c_uint, POINTER
from engine import (
INSTANCE_FLAG_SPAWNED, BATCH_MAX_SIZE, create_batch, draw_batch, destroy_batch)
INSTANCE_FLAG_SPAWNED, BATCH_MAX_SIZE, buffer, create_batch, draw_batch, destroy_batch)
class Batch:
__slots__ = '_batch', '_paramsp', 'size', 'max_size', 'flags', 'meshes', 'params'
@ -27,9 +27,9 @@ class Batch:
self._paramsp = POINTER(params_type)
self.size = 0
self.max_size = max_size
self.flags = (c_ubyte * max_size)()
self.meshes = (c_uint * max_size)()
self.params = (params_type * max_size)()
self.flags = buffer(c_ubyte, max_size)
self.meshes = buffer(c_uint, max_size)
self.params = buffer(params_type, max_size)
def __del__(self):
destroy_batch(self._batch)