当前位置: 首页>>代码示例>>Golang>>正文


Golang C.SDL_JoystickGetAxis函数代码示例

本文整理汇总了Golang中C.SDL_JoystickGetAxis函数的典型用法代码示例。如果您正苦于以下问题:Golang SDL_JoystickGetAxis函数的具体用法?Golang SDL_JoystickGetAxis怎么用?Golang SDL_JoystickGetAxis使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SDL_JoystickGetAxis函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Keystate

func Keystate(key string) int {
	if key == "joy1stick1x" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 0))
	}
	if key == "joy1stick1y" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 1))
	}
	if key == "joy1stick2x" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 3))
	}
	if key == "joy1stick2y" {
		makestickopened()
		return int(C.SDL_JoystickGetAxis(joy, 4))
	}
	if key == "joy1a" {
		makestickopened()
		return int(C.SDL_JoystickGetButton(joy, 0))
	}
	var length C.int
	keys := C.SDL_GetKeyboardState(&length)
	return int(*(*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(keys)) + uintptr(str2scancode(key))))) //letter scancodes start at 4

}
开发者ID:21isgonnabeagoodyear,项目名称:ggl,代码行数:26,代码来源:windowing.go

示例2: GetAxis

// Get the current state of an axis control on a joystick. The axis
// indices start at index 0. The state is a value ranging from -32768
// to 32767.
func (joystick *Joystick) GetAxis(axis int) int16 {
	return int16(C.SDL_JoystickGetAxis(joystick.cJoystick, C.int(axis)))
}
开发者ID:kearsley,项目名称:Go-SDL,代码行数:6,代码来源:sdl.go

示例3: GetAxis

func (joystick *Joystick) GetAxis(axis int) int16 {
	_joystick := (*C.SDL_Joystick)(joystick)
	_axis := (C.int)(axis)
	return (int16)(C.SDL_JoystickGetAxis(_joystick, _axis))
}
开发者ID:TomMurray,项目名称:go-sdl2,代码行数:5,代码来源:sdl_joystick.go

示例4: GetAxis

// Joystick (https://wiki.libsdl.org/SDL_JoystickGetAxis)
func (joy *Joystick) GetAxis(axis int) int16 {
	return (int16)(C.SDL_JoystickGetAxis(joy.cptr(), C.int(axis)))
}
开发者ID:tanema,项目名称:amore,代码行数:4,代码来源:joystick.go

示例5: GetAxis

func (j *Joystick) GetAxis(n int) int16 {
	return int16(C.SDL_JoystickGetAxis((*C.SDL_Joystick)(unsafe.Pointer(j)), C.int(n)))
}
开发者ID:gnanderson,项目名称:Go-SDL,代码行数:3,代码来源:sdl.go

示例6: JoystickGetAxis

// Get the current state of an axis control on a joystick
// The state is a value ranging from -32768 to 32767.
// The axis indices start at index 0.
func JoystickGetAxis(joystick *C.SDL_Joystick, axis int) int16 {
	return int16(C.SDL_JoystickGetAxis(joystick, C.int(axis)))
}
开发者ID:beoran,项目名称:fungo,代码行数:6,代码来源:joystick.go


注:本文中的C.SDL_JoystickGetAxis函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。