package module
Version: v0.0.0-...-b263a01 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2014 License: MIT Imports: 2 Imported by: 2



vJoy library for Go


vJoy is required to use this library. Tested with vJoy 2.0.4 on Windows 7 x64.


go get github.com/tajtiattila/vjoy


The library provides direct access to the vJoy interface library vJoyInderface.dll via github.com/tajtiattila/vjoy/dll, along with a more idiomatic Device class to update buttons and axes.

For further details see the Go documentation after installation.

Note: POV hats are not supported by vJoy yet.




This section is empty.


View Source
var (
	ErrDeviceAlreadyOwned = errors.New("vJoy Device already open by this application")
	ErrDeviceBusy         = errors.New("vJoy Device is owned by another application")
	ErrDeviceMissing      = errors.New("vJoy Device is missing: either does not exist or the driver is down")
	ErrDeviceUnknown      = errors.New("Unknown vJoy Device error")
	ErrReset              = errors.New("Reset failed")
	ErrUpdate             = errors.New("UpdateVJD failed")
	ErrUnknownName        = errors.New("Unknown name (axis, button or pov)")


func Available

func Available() bool

Available check if the vjoy.dll was successfully loaded and is enabled. Other functions in this library will likely panic if Available returns false.

func ManufacturerString

func ManufacturerString() string

func ProductString

func ProductString() string

func ResetAll

func ResetAll() error

ResetAll resets all VJD devices

func SerialNumberString

func SerialNumberString() string

func Version

func Version() uint

Version returns the version number of the installed vJoy.


type Axis

type Axis struct {
	// contains filtered or unexported fields

func (*Axis) Exists

func (a *Axis) Exists() bool

func (*Axis) Setc

func (a *Axis) Setc(val int)

Setc is same as Setu, but truncates values to permitted bounds

func (*Axis) Setf

func (a *Axis) Setf(val float32)

func (*Axis) Seti

func (a *Axis) Seti(val int)

func (*Axis) Setu

func (a *Axis) Setu(val int)

func (*Axis) Setuf

func (a *Axis) Setuf(val float32)

type AxisName

type AxisName uint
const (
	AxisX AxisName = iota

	MaxButton = 128

type Button

type Button struct {
	// contains filtered or unexported fields

func (*Button) Exists

func (b *Button) Exists() bool

func (*Button) Set

func (b *Button) Set(val bool)

type Device

type Device struct {
	// contains filtered or unexported fields

Device represents an open vJoy device

func Acquire

func Acquire(rid uint) (*Device, error)

Acquire opens a Device for use in the application.

func (*Device) Axes

func (d *Device) Axes() []*Axis

func (*Device) Axis

func (d *Device) Axis(n AxisName) *Axis

Axis returns the given Axis to update cached values for this device, to be submitted by Update()

func (*Device) Button

func (d *Device) Button(n uint) *Button

return Button number n

func (*Device) Buttons

func (d *Device) Buttons() []*Button

func (*Device) Hat

func (d *Device) Hat(n int) Hat

return Hat number n hats aren't yet supported by vjoy

func (*Device) Hats

func (d *Device) Hats() []Hat

func (*Device) Relinquish

func (d *Device) Relinquish()

Relinquish closes an acquired device

func (*Device) Reset

func (d *Device) Reset()

reset Device: Axes centered, Buttons and Hats off.

func (*Device) Update

func (d *Device) Update() error

Update VJD with values changed with in Button, Hat and Axis objects.

type Hat

type Hat interface {
	Exists() bool
	SetDegp(int) // set value in degree-percents (-1: off, 0-360000: direction)

type HatState

type HatState int
const (
	HatN   HatState = 0
	HatE   HatState = 1
	HatS   HatState = 2
	HatW   HatState = 3
	HatOff HatState = -1

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL