diff options
| author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-07-26 17:43:41 +0000 |
|---|---|---|
| committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-07-26 17:43:41 +0000 |
| commit | 22263b2869b1e01a21d5010d7092166b17113b15 (patch) | |
| tree | d1ec9368b5a8e04c5da23234a0c7d962aeb77d0c /packages/cocoaint/src/gamecontroller | |
| parent | 5d51dcce67a4f3ae7c59c50b8d654b6a8250025e (diff) | |
| download | fpc-22263b2869b1e01a21d5010d7092166b17113b15.tar.gz | |
* new CocoaInt units based on https://github.com/genericptr/MacOS_10_10
o note that CoreData and QuartzCore are now part of CocoaAll due to
dependencies
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@42500 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/cocoaint/src/gamecontroller')
14 files changed, 403 insertions, 0 deletions
diff --git a/packages/cocoaint/src/gamecontroller/GCController.inc b/packages/cocoaint/src/gamecontroller/GCController.inc new file mode 100644 index 0000000000..3560f2f1f8 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCController.inc @@ -0,0 +1,39 @@ +{ Parsed from GameController.framework GCController.h } + + +{$ifdef TYPES} +type + GCControllerPtr = ^GCController; +{$endif} + +{$ifdef EXTERNAL_SYMBOLS} +var + GCControllerDidConnectNotification: NSString; cvar; external; + GCControllerDidDisconnectNotification: NSString; cvar; external; +{$endif} + +{$ifdef TYPES} +const + GCControllerPlayerIndexUnset = -1; +{$endif} + +{$ifdef CLASSES} + +type + GCController = objcclass external (NSObject) + public + procedure setControllerPausedHandler(newValue: OpaqueCBlock); message 'setControllerPausedHandler:'; + function controllerPausedHandler: OpaqueCBlock; message 'controllerPausedHandler'; + function vendorName: NSString; message 'vendorName'; + function isAttachedToDevice: ObjCBOOL; message 'isAttachedToDevice'; + procedure setPlayerIndex(newValue: NSInteger); message 'setPlayerIndex:'; + function playerIndex: NSInteger; message 'playerIndex'; + function gamepad: GCGamepad; message 'gamepad'; + function extendedGamepad: GCExtendedGamepad; message 'extendedGamepad'; + function motion: GCMotion; message 'motion'; + class function controllers: NSArray; message 'controllers'; + class procedure startWirelessControllerDiscoveryWithCompletionHandler (completionHandler: OpaqueCBlock); message 'startWirelessControllerDiscoveryWithCompletionHandler:'; + class procedure stopWirelessControllerDiscovery; message 'stopWirelessControllerDiscovery'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCControllerAxisInput.inc b/packages/cocoaint/src/gamecontroller/GCControllerAxisInput.inc new file mode 100644 index 0000000000..d7dc981e54 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCControllerAxisInput.inc @@ -0,0 +1,27 @@ +{ Parsed from GameController.framework GCControllerAxisInput.h } + + +{ Types from GCControllerAxisInput } +{$ifdef TYPES} + +type + GCControllerAxisValueChangedHandler = OpaqueCBlock; +{$endif} + + +{$ifdef TYPES} +type + GCControllerAxisInputPtr = ^GCControllerAxisInput; +{$endif} + +{$ifdef CLASSES} + +type + GCControllerAxisInput = objcclass external (GCControllerElement) + public + procedure setValueChangedHandler(newValue: GCControllerAxisValueChangedHandler); message 'setValueChangedHandler:'; + function valueChangedHandler: GCControllerAxisValueChangedHandler; message 'valueChangedHandler'; + function value: single; message 'value'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCControllerButtonInput.inc b/packages/cocoaint/src/gamecontroller/GCControllerButtonInput.inc new file mode 100644 index 0000000000..c5d681c1e3 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCControllerButtonInput.inc @@ -0,0 +1,30 @@ +{ Parsed from GameController.framework GCControllerButtonInput.h } + + +{ Types from GCControllerButtonInput } +{$ifdef TYPES} + +type + GCControllerButtonValueChangedHandler = OpaqueCBlock; +{$endif} + + +{$ifdef TYPES} +type + GCControllerButtonInputPtr = ^GCControllerButtonInput; +{$endif} + +{$ifdef CLASSES} + +type + GCControllerButtonInput = objcclass external (GCControllerElement) + public + procedure setValueChangedHandler(newValue: GCControllerButtonValueChangedHandler); message 'setValueChangedHandler:'; + function valueChangedHandler: GCControllerButtonValueChangedHandler; message 'valueChangedHandler'; + procedure setPressedChangedHandler(newValue: GCControllerButtonValueChangedHandler); message 'setPressedChangedHandler:'; + function pressedChangedHandler: GCControllerButtonValueChangedHandler; message 'pressedChangedHandler'; + function value: single; message 'value'; + function isPressed: ObjCBOOL; message 'isPressed'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCControllerDirectionPad.inc b/packages/cocoaint/src/gamecontroller/GCControllerDirectionPad.inc new file mode 100644 index 0000000000..482499ae8f --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCControllerDirectionPad.inc @@ -0,0 +1,32 @@ +{ Parsed from GameController.framework GCControllerDirectionPad.h } + + +{ Types from GCControllerDirectionPad } +{$ifdef TYPES} + +type + GCControllerDirectionPadValueChangedHandler = OpaqueCBlock; +{$endif} + + +{$ifdef TYPES} +type + GCControllerDirectionPadPtr = ^GCControllerDirectionPad; +{$endif} + +{$ifdef CLASSES} + +type + GCControllerDirectionPad = objcclass external (GCControllerElement) + public + procedure setValueChangedHandler(newValue: GCControllerDirectionPadValueChangedHandler); message 'setValueChangedHandler:'; + function valueChangedHandler: GCControllerDirectionPadValueChangedHandler; message 'valueChangedHandler'; + function xAxis: GCControllerAxisInput; message 'xAxis'; + function yAxis: GCControllerAxisInput; message 'yAxis'; + function up: GCControllerButtonInput; message 'up'; + function down: GCControllerButtonInput; message 'down'; + function left: GCControllerButtonInput; message 'left'; + function right: GCControllerButtonInput; message 'right'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCControllerElement.inc b/packages/cocoaint/src/gamecontroller/GCControllerElement.inc new file mode 100644 index 0000000000..033f7bee4f --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCControllerElement.inc @@ -0,0 +1,28 @@ +{ Parsed from GameController.framework GCControllerElement.h } + + +{ Types from GCControllerElement } +{$ifdef TYPES} + +{$endif} + + +{$ifdef TYPES} +type + GCControllerElementPtr = ^GCControllerElement; +{$endif} + +{$ifdef CLASSES} + +type + GCControllerElement = objcclass external (NSObject) + public + {$if not defined(__has_feature)} + function collection: GCControllerElement; message 'collection'; + {$else} + function collection_: GCControllerElement; message 'collection'; + {$endif} + function isAnalog: ObjCBOOL; message 'isAnalog'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCExtendedGamepad.inc b/packages/cocoaint/src/gamecontroller/GCExtendedGamepad.inc new file mode 100644 index 0000000000..3329486ba0 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCExtendedGamepad.inc @@ -0,0 +1,44 @@ +{ Parsed from GameController.framework GCExtendedGamepad.h } + + +{ Types from GCExtendedGamepad } +{$ifdef TYPES} + + +type + GCExtendedGamepadValueChangedHandler = OpaqueCBlock; +{$endif} + + +{$ifdef TYPES} +type + GCExtendedGamepadPtr = ^GCExtendedGamepad; +{$endif} + +{$ifdef CLASSES} + +type + GCExtendedGamepad = objcclass external (NSObject) + public + {$if not defined(__has_feature)} + function controller: GCController; message 'controller'; + {$else} + function controller_: GCController; message 'controller'; + {$endif} + procedure setValueChangedHandler(newValue: GCExtendedGamepadValueChangedHandler); message 'setValueChangedHandler:'; + function valueChangedHandler: GCExtendedGamepadValueChangedHandler; message 'valueChangedHandler'; + function saveSnapshot: GCExtendedGamepadSnapshot; message 'saveSnapshot'; + function dpad: GCControllerDirectionPad; message 'dpad'; + function buttonA: GCControllerButtonInput; message 'buttonA'; + function buttonB: GCControllerButtonInput; message 'buttonB'; + function buttonX: GCControllerButtonInput; message 'buttonX'; + function buttonY: GCControllerButtonInput; message 'buttonY'; + function leftThumbstick: GCControllerDirectionPad; message 'leftThumbstick'; + function rightThumbstick: GCControllerDirectionPad; message 'rightThumbstick'; + function leftShoulder: GCControllerButtonInput; message 'leftShoulder'; + function rightShoulder: GCControllerButtonInput; message 'rightShoulder'; + function leftTrigger: GCControllerButtonInput; message 'leftTrigger'; + function rightTrigger: GCControllerButtonInput; message 'rightTrigger'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCExtendedGamepadSnapshot.inc b/packages/cocoaint/src/gamecontroller/GCExtendedGamepadSnapshot.inc new file mode 100644 index 0000000000..4f15b21f2f --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCExtendedGamepadSnapshot.inc @@ -0,0 +1,49 @@ +{ Parsed from GameController.framework GCExtendedGamepadSnapshot.h } + + +{$ifdef TYPES} +type + GCExtendedGamepadSnapshotPtr = ^GCExtendedGamepadSnapshot; +{$endif} + +{$ifdef CLASSES} + +type + GCExtendedGamepadSnapshot = objcclass external (GCExtendedGamepad) + public + procedure setSnapshotData(newValue: NSData); message 'setSnapshotData:'; + function snapshotData: NSData; message 'snapshotData'; + function initWithSnapshotData (data: NSData): instancetype; message 'initWithSnapshotData:'; + function initWithController_snapshotData (controller__: GCController; data: NSData): instancetype; message 'initWithController:snapshotData:'; + end; +{$endif} + +{$ifdef TYPES} +type + GCExtendedGamepadSnapShotDataV100 = record + version: cuint16; + size: cuint16; + dpadX: cfloat; + dpadY: cfloat; + buttonA: cfloat; + buttonB: cfloat; + buttonX: cfloat; + buttonY: cfloat; + leftShoulder: cfloat; + rightShoulder: cfloat; + leftThumbstickX: cfloat; + leftThumbstickY: cfloat; + rightThumbstickX: cfloat; + rightThumbstickY: cfloat; + leftTrigger: cfloat; + rightTrigger: cfloat; + end; +type + GCExtendedGamepadSnapShotDataV100Ptr = ^GCExtendedGamepadSnapShotDataV100; +{$endif} + +{$ifdef FUNCTIONS} +function GCExtendedGamepadSnapShotDataV100FromNSData(snapshotData: GCExtendedGamepadSnapShotDataV100Ptr; data: NSData): ObjCBOOL; cdecl; external; +function NSDataFromGCExtendedGamepadSnapShotDataV100(snapshotData: GCExtendedGamepadSnapShotDataV100Ptr): NSData; cdecl; external; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCGamepad.inc b/packages/cocoaint/src/gamecontroller/GCGamepad.inc new file mode 100644 index 0000000000..f166df4583 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCGamepad.inc @@ -0,0 +1,40 @@ +{ Parsed from GameController.framework GCGamepad.h } + + +{ Types from GCGamepad } +{$ifdef TYPES} + + +type + GCGamepadValueChangedHandler = OpaqueCBlock; +{$endif} + + +{$ifdef TYPES} +type + GCGamepadPtr = ^GCGamepad; +{$endif} + +{$ifdef CLASSES} + +type + GCGamepad = objcclass external (NSObject) + public + {$if not defined(__has_feature)} + function controller: GCController; message 'controller'; + {$else} + function controller_: GCController; message 'controller'; + {$endif} + procedure setValueChangedHandler(newValue: GCGamepadValueChangedHandler); message 'setValueChangedHandler:'; + function valueChangedHandler: GCGamepadValueChangedHandler; message 'valueChangedHandler'; + function saveSnapshot: GCGamepadSnapshot; message 'saveSnapshot'; + function dpad: GCControllerDirectionPad; message 'dpad'; + function buttonA: GCControllerButtonInput; message 'buttonA'; + function buttonB: GCControllerButtonInput; message 'buttonB'; + function buttonX: GCControllerButtonInput; message 'buttonX'; + function buttonY: GCControllerButtonInput; message 'buttonY'; + function leftShoulder: GCControllerButtonInput; message 'leftShoulder'; + function rightShoulder: GCControllerButtonInput; message 'rightShoulder'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCGamepadSnapshot.inc b/packages/cocoaint/src/gamecontroller/GCGamepadSnapshot.inc new file mode 100644 index 0000000000..7080245a34 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCGamepadSnapshot.inc @@ -0,0 +1,43 @@ +{ Parsed from GameController.framework GCGamepadSnapshot.h } + + +{$ifdef TYPES} +type + GCGamepadSnapshotPtr = ^GCGamepadSnapshot; +{$endif} + +{$ifdef CLASSES} + +type + GCGamepadSnapshot = objcclass external (GCGamepad) + public + procedure setSnapshotData(newValue: NSData); message 'setSnapshotData:'; + function snapshotData: NSData; message 'snapshotData'; + function initWithSnapshotData (data: NSData): instancetype; message 'initWithSnapshotData:'; + function initWithController_snapshotData (controller__: GCController; data: NSData): instancetype; message 'initWithController:snapshotData:'; + end; +{$endif} + +{$ifdef TYPES} +type + GCGamepadSnapShotDataV100 = record + version: cuint16; + size: cuint16; + dpadX: cfloat; + dpadY: cfloat; + buttonA: cfloat; + buttonB: cfloat; + buttonX: cfloat; + buttonY: cfloat; + leftShoulder: cfloat; + rightShoulder: cfloat; + end; +type + GCGamepadSnapShotDataV100Ptr = ^GCGamepadSnapShotDataV100; +{$endif} + +{$ifdef FUNCTIONS} +function GCGamepadSnapShotDataV100FromNSData(snapshotData: GCGamepadSnapShotDataV100Ptr; data: NSData): ObjCBOOL; cdecl; external; +function NSDataFromGCGamepadSnapShotDataV100(snapshotData: GCGamepadSnapShotDataV100Ptr): NSData; cdecl; external; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GCMotion.inc b/packages/cocoaint/src/gamecontroller/GCMotion.inc new file mode 100644 index 0000000000..5b791be4f2 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GCMotion.inc @@ -0,0 +1,57 @@ +{ Parsed from GameController.framework GCMotion.h } + + +{ Types from GCMotion } +{$ifdef TYPES} + + +type + GCMotionValueChangedHandler = OpaqueCBlock; +{$endif} + + +{$ifdef TYPES} +type + GCMotionPtr = ^GCMotion; +{$endif} + +{$ifdef TYPES} +type + GCAcceleration = record + x, y, z: double; + end; +type + GCAccelerationPtr = ^GCAcceleration; +type + GCRotationRate = record + x, y, z: double; + end; +type + GCRotationRatePtr = ^GCRotationRate; +type + GCQuaternion = record + x, y, z, w: double; + end; +type + GCQuaternionPtr = ^GCQuaternion; +{$endif} + +{$ifdef CLASSES} + +type + GCMotion = objcclass external (NSObject) + public + {$if not defined(__has_feature)} + function controller: GCController; message 'controller'; + {$else} + function controller_: GCController; message 'controller'; + {$endif} + procedure setValueChangedHandler(newValue: GCMotionValueChangedHandler); message 'setValueChangedHandler:'; + function valueChangedHandler: GCMotionValueChangedHandler; message 'valueChangedHandler'; + function gravity: GCAcceleration; message 'gravity'; + function userAcceleration: GCAcceleration; message 'userAcceleration'; + function attitude: GCQuaternion; message 'attitude'; + function rotationRate: GCRotationRate; message 'rotationRate'; + end; +{$endif} + diff --git a/packages/cocoaint/src/gamecontroller/GameController.inc b/packages/cocoaint/src/gamecontroller/GameController.inc new file mode 100644 index 0000000000..13efae4b57 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/GameController.inc @@ -0,0 +1,2 @@ +{ Parsed from GameController.framework GameController.h } + diff --git a/packages/cocoaint/src/gamecontroller/InlineFunctions.inc b/packages/cocoaint/src/gamecontroller/InlineFunctions.inc new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/InlineFunctions.inc diff --git a/packages/cocoaint/src/gamecontroller/Sources.inc b/packages/cocoaint/src/gamecontroller/Sources.inc new file mode 100644 index 0000000000..a15ffb2980 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/Sources.inc @@ -0,0 +1,12 @@ +{$define FRAMEWORK_LOADED_GAMECONTROLLER} +{$include GameController.inc} +{$include GCControllerElement.inc} +{$include GCControllerAxisInput.inc} +{$include GCControllerButtonInput.inc} +{$include GCControllerDirectionPad.inc} +{$include GCMotion.inc} +{$include GCGamepad.inc} +{$include GCGamepadSnapshot.inc} +{$include GCExtendedGamepad.inc} +{$include GCExtendedGamepadSnapshot.inc} +{$include GCController.inc} diff --git a/packages/cocoaint/src/gamecontroller/UndefinedTypes.inc b/packages/cocoaint/src/gamecontroller/UndefinedTypes.inc new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/cocoaint/src/gamecontroller/UndefinedTypes.inc |
