Beispiel #1
0
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(),
	}
}
Beispiel #2
0
//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()}
}