acquire method
VrInputEvent
acquire({
- required VrInputType type,
- required VrInputSource source,
- required int timestampMicrosecondsSinceEpoch,
- String? targetId,
- Map<
String, dynamic> ? data, - bool active = true,
Implementation
VrInputEvent acquire({
required VrInputType type,
required VrInputSource source,
required int timestampMicrosecondsSinceEpoch,
String? targetId,
Map<String, dynamic>? data,
bool active = true,
}) {
if (_freeSlots.isEmpty) {
throw StateError(
'VrInputEventPool exhausted ($capacity events are already in use).',
);
}
final slot = _freeSlots.removeLast();
final event = _events[slot];
event._checkedOut = true;
event.resetForReuse(
type: type,
source: source,
targetId: targetId,
data: data,
active: active,
timestampMicrosecondsSinceEpoch: timestampMicrosecondsSinceEpoch,
);
_inUseCount++;
_totalAcquisitions++;
if (_inUseCount > _peakInUse) _peakInUse = _inUseCount;
return event;
}