2024-05-11 23:24:13 +02:00
package motion
import "core:c"
import sce "../common"
foreign import motion "system:SceMotion_stub"
foreign motion {
/**
* Gets the current motion state.
*
* @param[out] *motionState - See ::SceMotionState
*
* @return 0, <0 on error.
*/
2024-05-13 16:04:23 +02:00
sceMotionGetState :: proc ( motionState : ^ SceMotionState ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Gets the current motion sensor state
*
* @param[in] numRecords - Amount of records to get
* @param[out] *motionSensorState - See ::SceMotionSensorState
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionGetSensorState :: proc ( sensorState : ^ SceMotionSensorState , numRecords : c . int ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Gets the location of the device's sensors in relation to its center point (in mm).
*
* @param[out] *deviceLocation - See ::SceMotionDeviceLocation
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionGetDeviceLocation :: proc ( deviceLocation : ^ SceMotionDeviceLocation ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Gets the basic orientation of the device in relation to gravity
* @note - Possible values in the output vector are -1, 0 and 1
* @note - Using the same coordinate system as ::SceMotionDeviceLocation these values are set in the vector depending on if the axies' positive or negative directions are facing away from gravitational pull
* @note - For example if the vita is laying on a flat and level surface, with the OLED/LCD side facing upwards, the Z part of the vector will be 1
* @note - Now flipping the device upwards, taking hold of the right joystick's side, until it forms a 90 degree angle to the surface will result in the X part of the vector being 1 instead
* @note - Both examples would result in the returned value being -1 if flipped 180 degrees, swapping their top and bottom sides in correlation to gravity
* @note - The angle of rotation in relation to being in a centered state on an axis (returned as 0) after which the device will change the value is determined by ::SceMotionSetAngleThreshold
* @note - In order for this function to return up to date data, ::GetState must be called prior to call this function.
* @param[out] *basicOrientation
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionGetBasicOrientation :: proc ( basicOrientation : ^ sce . FVector3 ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Rotate the yaw axis
*
* @param[in] radians - Rotation angle in radians
*
* @return 0
*/
2024-05-13 16:04:23 +02:00
sceMotionRotateYaw :: proc ( radians : c . float ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Get Status of tilt correction
* @note - With tilt correction enabled the data for roll and pitch movements of the device get recalculated to not distort the yaw movements in relation to gravity
* @note - Enabled by default
* @return 1 if enabled, 0 if disabled
*/
2024-05-13 16:04:23 +02:00
sceMotionGetTiltCorrection :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Activate/deactivate tilt correction
* @note - For more information see ::GetTiltCorrection
* @param[in] setValue - 1 to enable, 0 to disable
*
* @return 0
*/
2024-05-13 16:04:23 +02:00
sceMotionSetTiltCorrection :: proc ( setValue : c . int ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Get status of deadbanding
* @note - With deadbanding enabled the device will filter out small movements to reduce jitter
* @note - Potentially decreaces accuracy of fine movements
* @note - Enabled by default
* @return 1 if enabled, 0 if disabled
*/
2024-05-13 16:04:23 +02:00
sceMotionGetDeadband :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Activate/deactivate deadbanding
* @note - For more information see ::GetDeadbanding
* @param[in] setValue - 1 to enable, 0 to disable
*
* @return 0
*/
2024-05-13 16:04:23 +02:00
sceMotionSetDeadband :: proc ( setValue : c . int ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Get status of gyroscope bias correction
* @note - With gyroscope bias correction enabled the device will attempt to adjust for outside influences that could impact calibration
* @note - Enabled by default
* @return 1 if enabled, 0 if disabled
*/
2024-05-13 16:04:23 +02:00
sceMotionGetGyroBiasCorrection :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Activate/deactivate gyroscope bias correction
* @note - For more information see ::GetGyroBiasCorrection
* @param[in] setValue - 1 to enable, 0 to disable
*
* @return 0
*/
2024-05-13 16:04:23 +02:00
sceMotionSetGyroBiasCorrection :: proc ( setValue : c . int ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Define the angle threshold for basic orientation
*
* @param[in] angle - range of 0 to 45 degrees
*
* @return 0
*/
2024-05-13 16:04:23 +02:00
sceMotionSetAngleThreshold :: proc ( angle : c . float ) -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Get the angle threshold for basic orientation
*
* @return angle in degrees
*/
2024-05-13 16:04:23 +02:00
sceMotionGetAngleThreshold :: proc () -> c . float ---
2024-05-11 23:24:13 +02:00
/**
* Set current orientation as origin
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionReset :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Start magnetometer sampling
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionMagnetometerOn :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Stop magnetometer sampling
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionMagnetometerOff :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Get status of magnetometer sampling
*
* @return 1 if enabled, 0 if disabled
*/
2024-05-13 16:04:23 +02:00
sceMotionGetMagnetometerState :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Start sampling
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionStartSampling :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
/**
* Stop sampling
*
* @return 0, <0 on error
*/
2024-05-13 16:04:23 +02:00
sceMotionStopSampling :: proc () -> c . int ---
2024-05-11 23:24:13 +02:00
}