示例#1
0
文件: glfw.go 项目: maun/glfw
// Window handling
func CreateWindow(width, height, mode int, title string, share Window) (window Window, err error) {
	csTitle := C.CString(title)
	window = Window(C.glfwCreateWindow(
		C.int(width), C.int(height),
		C.int(mode), csTitle,
		C.GLFWwindow(share)))
	C.free(unsafe.Pointer(csTitle))

	if window == nil {
		err = errors.New("Failed to open window")
	}
	return
}
示例#2
0
文件: glfw.go 项目: maun/glfw
// Clipboard
func SetClipboardString(window Window, s string) {
	cs := C.CString(s)
	defer C.free(unsafe.Pointer(cs))
	C.glfwSetClipboardString(C.GLFWwindow(window), cs)
}
示例#3
0
文件: glfw.go 项目: maun/glfw
func ScrollOffset(window Window) (x, y float64) {
	var cx, cy C.double
	C.glfwGetScrollOffset(C.GLFWwindow(window), &cx, &cy)
	return float64(cx), float64(cy)
}
示例#4
0
文件: glfw.go 项目: maun/glfw
func SetCursorPos(window Window, x, y int) {
	C.glfwSetCursorPos(C.GLFWwindow(window), C.int(x), C.int(y))
}
示例#5
0
文件: glfw.go 项目: maun/glfw
func CursorPos(window Window) (x, y int) {
	var cx, cy C.int
	C.glfwGetCursorPos(C.GLFWwindow(window), &cx, &cy)
	return int(cx), int(cy)
}
示例#6
0
文件: glfw.go 项目: maun/glfw
func MouseButton(window Window, button int) int {
	return int(C.glfwGetMouseButton(C.GLFWwindow(window), C.int(button)))
}
示例#7
0
文件: glfw.go 项目: maun/glfw
func DestroyWindow(window Window) { C.glfwDestroyWindow(C.GLFWwindow(window)) }
示例#8
0
文件: glfw.go 项目: maun/glfw
func SwapBuffers(window Window) {
	C.glfwSwapBuffers(C.GLFWwindow(window))
}
示例#9
0
文件: glfw.go 项目: maun/glfw
// Input handling
func InputMode(window Window, mode int) int {
	return int(C.glfwGetInputMode(C.GLFWwindow(window), C.int(mode)))
}
示例#10
0
文件: glfw.go 项目: maun/glfw
func WindowParam(window Window, param int) int {
	return int(C.glfwGetWindowParam(C.GLFWwindow(window), C.int(param)))
}
示例#11
0
文件: glfw.go 项目: maun/glfw
func RestoreWindow(window Window) { C.glfwRestoreWindow(C.GLFWwindow(window)) }
示例#12
0
文件: glfw.go 项目: maun/glfw
func IconifyWindow(window Window) { C.glfwIconifyWindow(C.GLFWwindow(window)) }
示例#13
0
文件: glfw.go 项目: maun/glfw
func SetWindowSize(window Window, width, height int) {
	C.glfwSetWindowSize(C.GLFWwindow(window), C.int(width), C.int(height))
}
示例#14
0
文件: glfw.go 项目: maun/glfw
func WindowSize(window Window) (int, int) {
	var w, h C.int
	C.glfwGetWindowSize(C.GLFWwindow(window), &w, &h)
	return int(w), int(h)
}
示例#15
0
文件: glfw.go 项目: maun/glfw
func SetWindowTitle(window Window, title string) {
	cs := C.CString(title)
	defer C.free(unsafe.Pointer(cs))
	C.glfwSetWindowTitle(C.GLFWwindow(window), cs)
}
示例#16
0
文件: glfw.go 项目: maun/glfw
func ClipboardString(window Window) string {
	cs := C.glfwGetClipboardString(C.GLFWwindow(window))
	return C.GoString(cs)
}
示例#17
0
文件: glfw.go 项目: maun/glfw
// OpenGL support
func MakeContextCurrent(window Window) {
	C.glfwMakeContextCurrent(C.GLFWwindow(window))
}
示例#18
0
文件: glfw.go 项目: maun/glfw
func SetInputMode(window Window, mode, value int) {
	C.glfwSetInputMode(C.GLFWwindow(window), C.int(mode), C.int(value))
}
示例#19
0
文件: glfw.go 项目: maun/glfw
func CopyContext(source, destination Window, mask uint64) {
	C.glfwCopyContext(C.GLFWwindow(source), C.GLFWwindow(destination), C.ulong(mask))
}
示例#20
0
文件: glfw.go 项目: maun/glfw
func Key(window Window, key int) int {
	return int(C.glfwGetKey(C.GLFWwindow(window), C.int(key)))
}