示例#1
0
func NewWindow(width, height int, title string) *Window {
	win := C.glfwCreateWindow(C.int(width), C.int(height), C.CString(title), nil, nil)
	if win == nil {
		panic("GLFW:  Failed to create window.")
	}
	w := &Window{w: win}
	C.glfwSetWindowUserPointer(win, unsafe.Pointer(w))
	windows.Lock()
	windows.m[win] = w
	windows.Unlock()
	return w
}
示例#2
0
文件: window.go 项目: juturnas/glfw3
//SetUserPointer sets the user-defined pointer of the window. The current value
//is retained until the window is destroyed. The initial value is nil.
func (w *Window) SetUserPointer(pointer unsafe.Pointer) {
	C.glfwSetWindowUserPointer(w.data, pointer)
}