Example #1
0
File: glfw.go Project: 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
}
Example #2
0
File: glfw.go Project: 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)
}
Example #3
0
File: glfw.go Project: 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)
}
Example #4
0
File: glfw.go Project: maun/glfw
func SetCursorPos(window Window, x, y int) {
	C.glfwSetCursorPos(C.GLFWwindow(window), C.int(x), C.int(y))
}
Example #5
0
File: glfw.go Project: 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)
}
Example #6
0
File: glfw.go Project: maun/glfw
func MouseButton(window Window, button int) int {
	return int(C.glfwGetMouseButton(C.GLFWwindow(window), C.int(button)))
}
Example #7
0
File: glfw.go Project: maun/glfw
func DestroyWindow(window Window) { C.glfwDestroyWindow(C.GLFWwindow(window)) }
Example #8
0
File: glfw.go Project: maun/glfw
func SwapBuffers(window Window) {
	C.glfwSwapBuffers(C.GLFWwindow(window))
}
Example #9
0
File: glfw.go Project: maun/glfw
// Input handling
func InputMode(window Window, mode int) int {
	return int(C.glfwGetInputMode(C.GLFWwindow(window), C.int(mode)))
}
Example #10
0
File: glfw.go Project: maun/glfw
func WindowParam(window Window, param int) int {
	return int(C.glfwGetWindowParam(C.GLFWwindow(window), C.int(param)))
}
Example #11
0
File: glfw.go Project: maun/glfw
func RestoreWindow(window Window) { C.glfwRestoreWindow(C.GLFWwindow(window)) }
Example #12
0
File: glfw.go Project: maun/glfw
func IconifyWindow(window Window) { C.glfwIconifyWindow(C.GLFWwindow(window)) }
Example #13
0
File: glfw.go Project: maun/glfw
func SetWindowSize(window Window, width, height int) {
	C.glfwSetWindowSize(C.GLFWwindow(window), C.int(width), C.int(height))
}
Example #14
0
File: glfw.go Project: 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)
}
Example #15
0
File: glfw.go Project: maun/glfw
func SetWindowTitle(window Window, title string) {
	cs := C.CString(title)
	defer C.free(unsafe.Pointer(cs))
	C.glfwSetWindowTitle(C.GLFWwindow(window), cs)
}
Example #16
0
File: glfw.go Project: maun/glfw
func ClipboardString(window Window) string {
	cs := C.glfwGetClipboardString(C.GLFWwindow(window))
	return C.GoString(cs)
}
Example #17
0
File: glfw.go Project: maun/glfw
// OpenGL support
func MakeContextCurrent(window Window) {
	C.glfwMakeContextCurrent(C.GLFWwindow(window))
}
Example #18
0
File: glfw.go Project: maun/glfw
func SetInputMode(window Window, mode, value int) {
	C.glfwSetInputMode(C.GLFWwindow(window), C.int(mode), C.int(value))
}
Example #19
0
File: glfw.go Project: maun/glfw
func CopyContext(source, destination Window, mask uint64) {
	C.glfwCopyContext(C.GLFWwindow(source), C.GLFWwindow(destination), C.ulong(mask))
}
Example #20
0
File: glfw.go Project: maun/glfw
func Key(window Window, key int) int {
	return int(C.glfwGetKey(C.GLFWwindow(window), C.int(key)))
}