Beispiel #1
0
func NewWindow() (w *Window) {
	cw := C.openWindow()
	w = &Window{
		cw: cw,
	}
	return
}
Beispiel #2
0
func NewWindow(width, height int) (w *Window, err error) {
	cw := C.openWindow()
	w = &Window{
		cw: cw,
	}
	w.SetSize(width, height)
	return
}
Beispiel #3
0
func NewWindow(width, height int) (w *Window, err error) {
	onMainThread(func() {
		cw := C.openWindow()
		if cw == nil {
			err = errors.New("couldn't allocate window (out of memory?)")
			return
		}
		w = &Window{
			cw: cw,
		}
		w.SetSize(width, height)
	})
	return
}
Beispiel #4
0
func OpenWindow(windowProc uintptr, width, height int) (windowHandle unsafe.Pointer, err error) {
	var window C.HWND
	errCode := C.openWindow(
		unsafe.Pointer(windowProc),
		C.int(width),
		C.int(height),
		&window,
	)
	if errCode == C.OK {
		return unsafe.Pointer(window), nil
	}
	if errCode == C.Error_RegisterClassEx {
		return nil, errors.New("OpenWindow: RegisterClassEx failed")
	}
	if errCode == C.Error_CreateWindowEx {
		return nil, errors.New("OpenWindow: CreateWindowEx failed")
	}
	return nil, errors.New("OpenWindow: unknown error")
}