class OpenXR::Result

An OpenXR result code.

@see www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#return-codes

Attributes

function[R]

@return [Symbol]

result[R]

@return [Integer]

Public Class Methods

for(result) click to toggle source

@param [Integer] result @return [Class]

# File lib/openxr/result.rb, line 21
def self.for(result)
  case result
    # https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes
    when XR_SUCCESS then Success
    when XR_TIMEOUT_EXPIRED then Success
    when XR_SESSION_LOSS_PENDING then Success
    when XR_EVENT_UNAVAILABLE then Success
    when XR_SPACE_BOUNDS_UNAVAILABLE then Success
    when XR_SESSION_NOT_FOCUSED then Success
    when XR_FRAME_DISCARDED then Success
    # https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes
    when XR_ERROR_HANDLE_INVALID then HandleInvalid
    #when XR_ERROR_FORM_FACTOR_UNAVAILABLE then # TODO
    else self
  end
end
new(result, function = nil) click to toggle source

@param [Integer, to_i] result @param [Symbol] function

Calls superclass method
# File lib/openxr/result.rb, line 41
def initialize(result, function = nil)
  @result = result.to_i
  @function = function
  super(@function ? "#{@function} returned #{@result}" : @result.to_s)
end