Skip to content

A Go library for interfacing with the Gamecube controller adapter.

License

Notifications You must be signed in to change notification settings

Gurvan/go-gc-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-gc-adapter

A Go library for interfacing with the Gamecube controller adapter.

Example

package main

import (
	"fmt"
	"log"
	"time"

	gcadapter "github.com/Gurvan/go-gc-adapter"
)

func main() {
	adapter, err := gcadapter.NewGCAdapter()
	if err != nil {
		log.Fatalf("%v", err)
	}
	defer adapter.Close()
	go adapter.StartPolling()

	go func() {
		for range time.Tick(time.Second / time.Duration(60.)) {
			inputs := adapter.Controllers()
			fmt.Println(inputs[0])
		}
	}()
	time.Sleep(10 * time.Second)
}