mark data type

This commit is contained in:
Eason
2024-04-25 18:20:59 +08:00
parent bd58db47d1
commit e2a59c827a
4 changed files with 17 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import pygame
from ctypes import *
libpyr = cdll.LoadLibrary("./pyr/target/release/libpyr.so")
app_ptr = c_ulonglong(0)
class Overall(Structure):
@ -36,6 +37,18 @@ class Food(Structure):
("kind", c_int32),
]
libpyr.tick.argtypes = [c_ulonglong, POINTER(Overall), POINTER(Food), c_uint64]
libpyr.tick.restype = c_int32
libpyr.new_app.argtypes = []
libpyr.new_app.restype = c_ulonglong
libpyr.drop_app.argtypes = [c_ulonglong]
libpyr.drop_app.restype = None
libpyr.check_point.argtypes = [c_ulonglong]
libpyr.check_point.restype = None
def new_app():
global app_ptr
app_ptr=c_ulonglong(libpyr.new_app())
@ -89,7 +102,7 @@ def tick(scene_info: dict):
elif kind=="GARBAGE_3":
foods[i].kind=c_int(6)
result=libpyr.tick(app_ptr,pointer(overall),pointer(foods),c_uint64(n))
result=libpyr.tick(app_ptr,(pointer(overall)),(POINTER(Food))(pointer(foods)),c_uint64(n))
if result==1:
return ["UP"]
if result==2: