Use the new buffer method to create ctypes arrays.
This commit is contained in:
parent
858dcd95bc
commit
34277274a3
@ -16,7 +16,7 @@
|
|||||||
from ctypes import c_ubyte, c_uint, POINTER
|
from ctypes import c_ubyte, c_uint, POINTER
|
||||||
|
|
||||||
from engine import (
|
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:
|
class Batch:
|
||||||
__slots__ = '_batch', '_paramsp', 'size', 'max_size', 'flags', 'meshes', 'params'
|
__slots__ = '_batch', '_paramsp', 'size', 'max_size', 'flags', 'meshes', 'params'
|
||||||
@ -27,9 +27,9 @@ class Batch:
|
|||||||
self._paramsp = POINTER(params_type)
|
self._paramsp = POINTER(params_type)
|
||||||
self.size = 0
|
self.size = 0
|
||||||
self.max_size = max_size
|
self.max_size = max_size
|
||||||
self.flags = (c_ubyte * max_size)()
|
self.flags = buffer(c_ubyte, max_size)
|
||||||
self.meshes = (c_uint * max_size)()
|
self.meshes = buffer(c_uint, max_size)
|
||||||
self.params = (params_type * max_size)()
|
self.params = buffer(params_type, max_size)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
destroy_batch(self._batch)
|
destroy_batch(self._batch)
|
||||||
|
Loading…
Reference in New Issue
Block a user