作者:beora
项目:fung
// Retrieve the current state of the mouse.
// The current button state is returned as a button bitmask, which can
// be tested using the SDL_BUTTON(X) macros, and x and y are set to the
// mouse deltas since the last call to SDL_GetRelativeMouseState().
func GetRelativeMouseState() (uint8, int, int) {
var x, y int
px := (*C.int)(unsafe.Pointer(&x))
py := (*C.int)(unsafe.Pointer(&y))
but := uint8(C.SDL_GetRelativeMouseState(px, py))
return but, x, y
}
作者:21isgonnabeagoodyea
项目:gg
func Mouserelative() (int, int, uint32) {
var x C.int
var y C.int
state := C.SDL_GetRelativeMouseState(&x, &y)
C.SDL_SetRelativeMouseMode(C.SDL_TRUE)
return int(x), int(y), uint32(state)
/*
state := C.SDL_GetMouseState(&x,&y)
C.SDL_WarpMouseInWindow(win, 100,100)
return int(x)-100,int(y)-100,uint32(state)
*/
}
作者:kearsle
项目:Go-SD
// Retrieves the current state of the mouse relative to the last time this
// function was called.
func GetRelativeMouseState(x, y *int) uint8 {
GlobalMutex.Lock()
state := uint8(C.SDL_GetRelativeMouseState((*C.int)(cast(x)), (*C.int)(cast(y))))
GlobalMutex.Unlock()
return state
}
作者:gnanderso
项目:Go-SD
// Retrieves the current state of the mouse relative to the last time this
// function was called.
func GetRelativeMouseState(x, y *int) uint8 {
return uint8(C.SDL_GetRelativeMouseState((*C.int)(cast(x)), (*C.int)(cast(y))))
}
作者:kri
项目:Go-SDL
// Retrieves the current state of the mouse relative to the last time this
// function was called.
func GetRelativeMouseState() (uint32, int, int) {
var x C.int = 0
var y C.int = 0
state := uint32(C.SDL_GetRelativeMouseState(&x, &y))
return state, int(x), int(y)
}
作者:kyleconro
项目:gold
func GetRelativeMouseState(x, y *int) uint32 {
_x := (*C.int)(unsafe.Pointer(x))
_y := (*C.int)(unsafe.Pointer(y))
return (uint32)(C.SDL_GetRelativeMouseState(_x, _y))
}
作者:veandc
项目:go-sdl
// GetRelativeMouseState (https://wiki.libsdl.org/SDL_GetRelativeMouseState)
func GetRelativeMouseState() (x, y int, state uint32) {
var _x, _y C.int
_state := uint32(C.SDL_GetRelativeMouseState(&_x, &_y))
return int(_x), int(_y), _state
}
作者:willemvd
项目:sd
func GetRelativeMouseState() (state uint8, x, y int) {
var cx, cy C.int
cstate := C.SDL_GetRelativeMouseState(&cx, &cy)
return uint8(cstate), int(cx), int(cy)
}