Example #1
0
File: gmdgo.go Project: waxcorp/gmd
func NewWindow() (w *Window) {
	cw := C.openWindow()
	w = &Window{
		cw: cw,
	}
	return
}
Example #2
0
func NewWindow(width, height int) (w *Window, err error) {
	cw := C.openWindow()
	w = &Window{
		cw: cw,
	}
	w.SetSize(width, height)
	return
}
Example #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
}
Example #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")
}