Beispiel #1
0
// resize adapts the window and texture content to the current size of the
// window. It should be called periodically to adapt to GUI changes to the
// window. It checks the new window dimensions and if necessary creates a new
// texture with new size. Previously drawn content will be lost.
func (w *Window) resize() {
	var width, height int
	C.glfwGetWindowSize(
		w.glfwWin,
		(*C.int)(unsafe.Pointer(&width)),
		(*C.int)(unsafe.Pointer(&height)),
	)
	if width != w.width || height != w.height {
		w.width = width
		w.height = height
		w.tex = newTex(width, height)
		w.texId = C.resizeTex(
			w.glfwWin,
			w.texId,
			unsafe.Pointer(&w.tex[0]),
			C.int(width),
			C.int(height),
		)
		C.winResized(w.glfwWin, C.int(width), C.int(height))
	}
}
Beispiel #2
0
// WindowSize is used for determining the size of an opened window. The returned
// values are dimensions of the client area of the window (i.e. excluding any
// window borders and decorations).
//
// Note: Even if the size of a fullscreen window does not change once the window
// has been opened, it does not necessarily have to be the same as the size that
// was requested using glfw.OpenWindow. Therefor it is wise to use this function
// to determine the true size of the window once it has been opened.
func WindowSize() (int, int) {
	var w, h C.int
	C.glfwGetWindowSize(&w, &h)
	return int(w), int(h)
}
Beispiel #3
0
Datei: glfw.go Projekt: maun/glfw
func WindowSize(window Window) (int, int) {
	var w, h C.int
	C.glfwGetWindowSize(C.GLFWwindow(window), &w, &h)
	return int(w), int(h)
}
Beispiel #4
0
func (w *Window) Size() (width, height int) {
	var wid, hei C.int
	C.glfwGetWindowSize(w.w, &wid, &hei)
	return int(wid), int(hei)
}
Beispiel #5
0
//GetSize returns the size, in screen coordinates, of the client area of the
//specified window.
func (w *Window) GetSize() (width, height int) {
	var wi, h C.int
	C.glfwGetWindowSize(w.data, &wi, &h)
	return int(wi), int(h)
}