示例#1
0
文件: web.go 项目: phaikawl/gosui
func NewWindow(b gs.RenderBackend, w, h int, title string) *Window {
	b.Init(w, h)
	return &Window{
		b:    b,
		area: gs.MakeRectWH(0, 0, w, h),
		root: gs.NewRootElement(),
	}
}
示例#2
0
文件: window.go 项目: phaikawl/gosui
//NewWindow creates and return a new Window
func NewWindow(b RenderBackend, w, h int, title string) *Window {
	glfw.SetErrorCallback(errorCallback)

	if !glfw.Init() {
		panic("Can't init glfw!")
	}

	window, err := glfw.CreateWindow(w, h, title, nil, nil)
	if err != nil {
		panic(err)
	}

	window.MakeContextCurrent()
	b.Init(w, h)
	setupGL(w, h)

	return &Window{window, b, gs.NewRootElement()}
}