1234567891011121314151617181920212223242526272829303132333435 |
- import 'dart:ffi';
- import 'dart:typed_data';
- import 'package:ffi/ffi.dart';
- import 'package:shoes_sdk/shoes_sdk.dart';
- void gameInit(int type) {
- sdk.gameInit(type, 1);
- }
- Pointer<Int32> result = int32ListToArrayPointer([-1, -1, -1, -1]);
- void gameProcess(Uint8List byteArray) {
- int length = byteArray.length;
- Pointer<Uint8> ptr = calloc<Uint8>(length);
- ptr.asTypedList(length).setAll(0, byteArray);
- sdk.gameProcessBuf(0, ptr, length, result);
- }
- List<int> getMotion() {
- sdk.getGameResult(0, result);
- return result.asTypedList(4);
- }
- int getInteractionCMD() {
- return sdk.getInteractionCMD();
- }
- String getVersion() {
- Pointer<Int8> ptr = calloc<Int8>(32);
- sdk.getGameVersion(ptr);
- var utf8 = ptr.cast<Utf8>();
- print("getVersion ${utf8} ${utf8.length}");
- return utf8.toDartString();
- }
|