Commit d86c5916 authored by simon's avatar simon
Browse files

comment + expose osEvent

parent 335f9a6f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -17,6 +17,20 @@ event 'Moment' returns whatever the underlying Linux driver provides as the even

hat channel event provides current position, (x,y) the event will need casting to the hat event to access these. (with only one axis changing per event.)

or (DIY)

'Connect' to a joystick by index number

handle all events directly using the returned State's OSEvent channel.

*/
package joysticks
/*

could be used with little change on any linux 'input' 

relies on initial event state burst to setup available events register.

linux driver doesn't allow blocking other programs from read from the same device, but they dont consume.

*/
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ type button struct {
}

type State struct {
	osEvent           chan osEventRecord
	OSEvent           chan osEventRecord
	buttons           map[uint8]button
	hatAxes           map[uint8]hatAxis
	buttonCloseEvents map[uint8]chan event
@@ -89,7 +89,7 @@ func (js State) ProcessEvents() {
	}
}

// Register methods to be called for event index, (event type indicated by method.)
// Type of registerable methods and the index they are called with. (Note: the event type is indicated by the method.)
type Channel struct {
	Number    uint8
	Method func(State, uint8) chan event