mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
fb3a022327
commit
11d01f4de1
@ -49,6 +49,7 @@ package cbackend
|
||||
// void EbitenGetGamepads(struct Gamepad* gamepads);
|
||||
// int EbitenGetTouchNum();
|
||||
// void EbitenGetTouches(struct Touch* touches);
|
||||
// void EbitenVibrateGamepad(int id, double durationInSeconds, double strongMagnitude, double weakMagnitude);
|
||||
//
|
||||
// // Audio
|
||||
// typedef void (*OnReadCallback)(float* buf, size_t length);
|
||||
@ -63,6 +64,7 @@ import "C"
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/driver"
|
||||
@ -159,6 +161,10 @@ func AppendTouches(touches []Touch) []Touch {
|
||||
return touches
|
||||
}
|
||||
|
||||
func VibrateGamepad(id driver.GamepadID, duration time.Duration, strongMagnitude float64, weakMagnitude float64) {
|
||||
C.EbitenVibrateGamepad(C.int(id), C.double(float64(duration)/float64(time.Second)), C.double(strongMagnitude), C.double(weakMagnitude))
|
||||
}
|
||||
|
||||
var onReadCallback func(buf []float32)
|
||||
|
||||
func OpenAudio(sampleRate, channelNum int, onRead func(buf []float32)) {
|
||||
|
@ -264,6 +264,7 @@ func (i *Input) TouchPosition(id driver.TouchID) (x, y int) {
|
||||
}
|
||||
|
||||
func (i *Input) VibrateGamepad(id driver.GamepadID, duration time.Duration, strongMagnitude float64, weakMagnitude float64) {
|
||||
cbackend.VibrateGamepad(id, duration, strongMagnitude, weakMagnitude)
|
||||
}
|
||||
|
||||
func (i *Input) Wheel() (xoff, yoff float64) {
|
||||
|
Loading…
Reference in New Issue
Block a user