toNative method
Implementation
@override
Pointer<SdlHapticEffect> toNative([Allocator allocator = ffi.calloc]) {
final pointer = allocator<SdlHapticEffect>();
final ref = pointer.ref.custom..type = type;
direction.copyTo(ref.direction);
ref
..length = length
..delay = delay
..button = button
..interval = interval
..channels = channels
..period = period
..samples = samples;
if (data != null && data!.isNotEmpty) {
final dataPointer = allocator<Uint16>(data!.length);
dataPointer.asTypedList(data!.length).setAll(0, data!);
ref.data = dataPointer;
} else {
ref.data = nullptr;
}
ref
..attackLength = attackLength
..attackLevel = attackLevel
..fadeLength = fadeLength
..fadeLevel = fadeLevel;
return pointer;
}