Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
elect86 committed Feb 16, 2018
1 parent 7115883 commit f5ec4ac
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 65 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ More information on OpenVR and SteamVR can be found on http://steamvr.com
- original comments preserved and properly formatted
- every struct method is offered also much more user friendly offering also full interoperability with glm, `getProjectionMatrix` returns, for example, directly a glm `Mat4`
```kotlin
IVRSystem.GetProjectionMatrix(eEye: Int, fNearZ: Float, fFarZ: Float): HmdMatrix44_t.ByValue
IVRSystem.GetProjectionMatrix(eEye: Int, fNearZ: Float, fFarZ: Float): HmdMatrix44.ByValue
```
because of the jna binding requirements, shall be called as:
```kotlin
IVRSystem.GetProjectionMatrix.invoke(eEye: Int, fNearZ: Float, fFarZ: Float): HmdMatrix44_t.ByValue
IVRSystem.GetProjectionMatrix.invoke(eEye: Int, fNearZ: Float, fFarZ: Float): HmdMatrix44.ByValue
```
but there is also the possibility to simply call:
```kotlin
Expand All @@ -48,7 +48,7 @@ getStringTrackedDeviceProperty(..): String
```
that returns directly the resulting string, bringing down a lot of boilerplate code

- array classes `[]` operator, included `RenderModel_Vertex_t`
- array classes `[]` operator, included `RenderModel_Vertex`
- concise enumerators, e.g. `EVRComponentProperty.VRComponentProperty_IsStatic` is `EVRComponentProperty.IsStatic`
- `SteamVRListener` for event listener. Instantiate a class extending it, call `.poll()` on it at the begin of each frame and override the corresponding methods you are looking for, such as `buttonPress(left: Boolean, button: EVRButtonId)`

Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/openvr/lib/ivrApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ open class IVRApplications : Structure {
}

/** Launches an instance of an application of value template, with its app key being newAppKey (which must be unique) and optionally override sections
* from the manifest file via openvr.lib.AppOverrideKeys_t */
fun launchTemplateApplication(templateAppKey: String, newAppKey: String, keys: AppOverrideKeys_t.ByReference, keysCount: Int) = EVRApplicationError.of(LaunchTemplateApplication!!.invoke(templateAppKey, newAppKey, keys, keysCount))
* from the manifest file via openvr.lib.AppOverrideKeys */
fun launchTemplateApplication(templateAppKey: String, newAppKey: String, keys: AppOverrideKeys.ByReference, keysCount: Int) = EVRApplicationError.of(LaunchTemplateApplication!!.invoke(templateAppKey, newAppKey, keys, keysCount))

@JvmField
var LaunchTemplateApplication: LaunchTemplateApplication_callback? = null

interface LaunchTemplateApplication_callback : Callback {
fun invoke(pchTemplateAppKey: String, pchNewAppKey: String, pKeys: AppOverrideKeys_t.ByReference, unKeys: Int): Int
fun invoke(pchTemplateAppKey: String, pchNewAppKey: String, pKeys: AppOverrideKeys.ByReference, unKeys: Int): Int
}

/** launches the application currently associated with this mime value and passes it the option args, typically the filename or object name of the item being
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/openvr/lib/ivrNotifications.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.*
// ivrnotifications.h =============================================================================================================================================

// Used for passing graphic data
open class NotificationBitmap_t : Structure {
open class NotificationBitmap : Structure {

@JvmField
var imageData: Pointer? = null
Expand All @@ -33,8 +33,8 @@ open class NotificationBitmap_t : Structure {
read()
}

class ByReference : NotificationBitmap_t(), Structure.ByReference
class ByValue : NotificationBitmap_t(), Structure.ByValue
class ByReference : NotificationBitmap(), Structure.ByReference
class ByValue : NotificationBitmap(), Structure.ByValue
}

/** Be aware that the notification value is used as 'priority' to pick the next notification */
Expand Down Expand Up @@ -96,12 +96,12 @@ open class IVRNotifications : Structure {
* An overlay handle is required to create a notification, as otherwise it would be impossible for a user to act on it.
* To create a two-line notification, use a line break ('\n') to split the text into two lines.
* The image argument may be NULL, in which case the specified overlay's icon will be used instead. */
fun createNotification(overlayHandle: VROverlayHandle, userValue: Long, type: EVRNotificationType, text: String, style: EVRNotificationStyle, image: NotificationBitmap_t.ByReference, /* out */ notificationId: VRNotificationId_ByReference) = EVRNotificationError.of(CreateNotification!!(overlayHandle, userValue, type.i, text, style.i, image, notificationId))
fun createNotification(overlayHandle: VROverlayHandle, userValue: Long, type: EVRNotificationType, text: String, style: EVRNotificationStyle, image: NotificationBitmap.ByReference, /* out */ notificationId: VRNotificationId_ByReference) = EVRNotificationError.of(CreateNotification!!(overlayHandle, userValue, type.i, text, style.i, image, notificationId))

@JvmField var CreateNotification: CreateNotification_callback? = null

interface CreateNotification_callback : Callback {
operator fun invoke(ulOverlayHandle: VROverlayHandle, ulUserValue: Long, type: Int, pchText: String, style: Int, pImage: NotificationBitmap_t.ByReference, /* out */ pNotificationId: VRNotificationId_ByReference): Int
operator fun invoke(ulOverlayHandle: VROverlayHandle, ulUserValue: Long, type: Int, pchText: String, style: Int, pImage: NotificationBitmap.ByReference, /* out */ pNotificationId: VRNotificationId_ByReference): Int
}

/** Destroy a notification, hiding it first if it currently shown to the user. */
Expand Down
54 changes: 27 additions & 27 deletions src/main/kotlin/openvr/lib/ivrOverlay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ enum class VROverlayFlags(@JvmField val i: Int) {
/** Indicates that the overlay should dim/brighten to show gamepad focus */
ShowGamepadFocus(5),

/** When in VROverlayInputMethod_Mouse you can optionally enable sending VRScroll_t */
/** When in VROverlayInputMethod_Mouse you can optionally enable sending VRScroll */
SendVRScrollEvents(6),
SendVRTouchpadEvents(7),

Expand Down Expand Up @@ -128,7 +128,7 @@ enum class VRMessageOverlayResponse(@JvmField val i: Int) {
}
}

open class VROverlayIntersectionParams_t : Structure {
open class VROverlayIntersectionParams : Structure {

@JvmField
var source = HmdVec3()
Expand Down Expand Up @@ -156,11 +156,11 @@ open class VROverlayIntersectionParams_t : Structure {
read()
}

class ByReference : VROverlayIntersectionParams_t(), Structure.ByReference
class ByValue : VROverlayIntersectionParams_t(), Structure.ByValue
class ByReference : VROverlayIntersectionParams(), Structure.ByReference
class ByValue : VROverlayIntersectionParams(), Structure.ByValue
}

open class VROverlayIntersectionResults_t : Structure {
open class VROverlayIntersectionResults : Structure {

@JvmField
var point = HmdVec3()
Expand All @@ -186,8 +186,8 @@ open class VROverlayIntersectionResults_t : Structure {
read()
}

class ByReference : VROverlayIntersectionResults_t(), Structure.ByReference
class ByValue : VROverlayIntersectionResults_t(), Structure.ByValue
class ByReference : VROverlayIntersectionResults(), Structure.ByReference
class ByValue : VROverlayIntersectionResults(), Structure.ByValue
}

// Input modes for the Big Picture gamepad text entry
Expand Down Expand Up @@ -238,7 +238,7 @@ enum class EVROverlayIntersectionMaskPrimitiveType(@JvmField val i: Int) {
}
}

open class IntersectionMaskRectangle_t : Structure {
open class IntersectionMaskRectangle : Structure {

@JvmField
var topLeftX = 0f
Expand All @@ -264,11 +264,11 @@ open class IntersectionMaskRectangle_t : Structure {
read()
}

class ByReference : IntersectionMaskRectangle_t(), Structure.ByReference
class ByValue : IntersectionMaskRectangle_t(), Structure.ByValue
class ByReference : IntersectionMaskRectangle(), Structure.ByReference
class ByValue : IntersectionMaskRectangle(), Structure.ByValue
}

open class IntersectionMaskCircle_t : Structure {
open class IntersectionMaskCircle : Structure {

@JvmField
var centerX = 0f
Expand All @@ -291,32 +291,32 @@ open class IntersectionMaskCircle_t : Structure {
read()
}

class ByReference : IntersectionMaskRectangle_t(), Structure.ByReference
class ByValue : IntersectionMaskRectangle_t(), Structure.ByValue
class ByReference : IntersectionMaskRectangle(), Structure.ByReference
class ByValue : IntersectionMaskRectangle(), Structure.ByValue
}

/** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py and openvr_api_flat.h.py */
abstract class VROverlayIntersectionMaskPrimitive_Data_t : Union() {
abstract class VROverlayIntersectionMaskPrimitive_Data : Union() {

class ByValue : VROverlayIntersectionMaskPrimitive_Data_t(), Structure.ByValue
class ByValue : VROverlayIntersectionMaskPrimitive_Data(), Structure.ByValue

var rectangle: IntersectionMaskRectangle_t? = null
var circle: IntersectionMaskCircle_t? = null
var rectangle: IntersectionMaskRectangle? = null
var circle: IntersectionMaskCircle? = null
}

open class VROverlayIntersectionMaskPrimitive_t : Structure {
open class VROverlayIntersectionMaskPrimitive : Structure {

@JvmField
var primitiveType = 0
@JvmField
var primitive: VROverlayIntersectionMaskPrimitive_Data_t? = null
var primitive: VROverlayIntersectionMaskPrimitive_Data? = null

constructor()

constructor(primitiveType: EVROverlayIntersectionMaskPrimitiveType, primitive: VROverlayIntersectionMaskPrimitive_Data_t) :
constructor(primitiveType: EVROverlayIntersectionMaskPrimitiveType, primitive: VROverlayIntersectionMaskPrimitive_Data) :
this(primitiveType.i, primitive)

constructor(m_nPrimitiveType: Int, m_Primitive: VROverlayIntersectionMaskPrimitive_Data_t) {
constructor(m_nPrimitiveType: Int, m_Primitive: VROverlayIntersectionMaskPrimitive_Data) {
this.primitiveType = m_nPrimitiveType
this.primitive = m_Primitive
}
Expand All @@ -327,8 +327,8 @@ open class VROverlayIntersectionMaskPrimitive_t : Structure {
read()
}

class ByReference : VROverlayIntersectionMaskPrimitive_t(), Structure.ByReference
class ByValue : VROverlayIntersectionMaskPrimitive_t(), Structure.ByValue
class ByReference : VROverlayIntersectionMaskPrimitive(), Structure.ByReference
class ByValue : VROverlayIntersectionMaskPrimitive(), Structure.ByValue
}

open class IVROverlay : Structure {
Expand Down Expand Up @@ -898,13 +898,13 @@ open class IVROverlay : Structure {

/** Computes the overlay-space pixel coordinates of where the ray intersects the overlay with the specified settings. Returns false if there is no
* intersection. */
fun computeOverlayIntersection(overlayHandle: VROverlayHandle, params: VROverlayIntersectionParams_t.ByReference, results: VROverlayIntersectionResults_t.ByReference) = ComputeOverlayIntersection!!(overlayHandle, params, results)
fun computeOverlayIntersection(overlayHandle: VROverlayHandle, params: VROverlayIntersectionParams.ByReference, results: VROverlayIntersectionResults.ByReference) = ComputeOverlayIntersection!!(overlayHandle, params, results)

@JvmField
var ComputeOverlayIntersection: ComputeOverlayIntersection_callback? = null

interface ComputeOverlayIntersection_callback : Callback {
operator fun invoke(ulOverlayHandle: VROverlayHandle, pParams: VROverlayIntersectionParams_t.ByReference, pResults: VROverlayIntersectionResults_t.ByReference): Boolean
operator fun invoke(ulOverlayHandle: VROverlayHandle, pParams: VROverlayIntersectionParams.ByReference, pResults: VROverlayIntersectionResults.ByReference): Boolean
}

/** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over" by the virtual mouse
Expand Down Expand Up @@ -1223,13 +1223,13 @@ open class IVROverlay : Structure {
/** Sets a list of primitives to be used for controller ray intersection typically the size of the underlying UI in pixels
* (not in world space). */
@JvmOverloads
fun setOverlayIntersectionMask(overlayHandle: VROverlayHandle, maskPrimitives: VROverlayIntersectionMaskPrimitive_t.ByReference, numMaskPrimitives: Int, primitiveSize: Int = Int.BYTES + Pointer.SIZE) = SetOverlayIntersectionMask!!(overlayHandle, maskPrimitives, numMaskPrimitives, primitiveSize)
fun setOverlayIntersectionMask(overlayHandle: VROverlayHandle, maskPrimitives: VROverlayIntersectionMaskPrimitive.ByReference, numMaskPrimitives: Int, primitiveSize: Int = Int.BYTES + Pointer.SIZE) = SetOverlayIntersectionMask!!(overlayHandle, maskPrimitives, numMaskPrimitives, primitiveSize)

@JvmField
var SetOverlayIntersectionMask: SetOverlayIntersectionMask_callback? = null

interface SetOverlayIntersectionMask_callback : Callback {
operator fun invoke(ulOverlayHandle: VROverlayHandle, pMaskPrimitives: VROverlayIntersectionMaskPrimitive_t.ByReference, unNumMaskPrimitives: Int, unPrimitiveSize: Int): EVROverlayError
operator fun invoke(ulOverlayHandle: VROverlayHandle, pMaskPrimitives: VROverlayIntersectionMaskPrimitive.ByReference, unNumMaskPrimitives: Int, unPrimitiveSize: Int): EVROverlayError
}


Expand Down
Loading

0 comments on commit f5ec4ac

Please sign in to comment.