Exemple #1
0
// 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
}
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)
	*/
}
Exemple #3
0
// 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
}
Exemple #4
0
// 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))))
}
Exemple #5
0
// 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)
}
Exemple #6
0
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))
}
Exemple #7
0
// 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
}
Exemple #8
0
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)
}