From 34277274a3f96718a18f40a67538b193ec87fc32 Mon Sep 17 00:00:00 2001 From: Roz K Date: Fri, 23 Dec 2022 10:24:21 +0100 Subject: [PATCH] Use the new buffer method to create ctypes arrays. --- game/batch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/game/batch.py b/game/batch.py index 327cf8a..d167fed 100644 --- a/game/batch.py +++ b/game/batch.py @@ -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)