Kaynağa Gözat

Merge pull request #37 from exploser/master

Expose SetInputMode, SetCursorPos and GetFramebufferSize from glfw
Daniel Salvadori 7 yıl önce
ebeveyn
işleme
d9e5da5222
2 değiştirilmiş dosya ile 23 ekleme ve 0 silme
  1. 20 0
      window/glfw.go
  2. 3 0
      window/window.go

+ 20 - 0
window/glfw.go

@@ -282,6 +282,12 @@ func (w *glfwWindow) Size() (width int, height int) {
 	return w.win.GetSize()
 	return w.win.GetSize()
 }
 }
 
 
+// FramebufferSize returns framebuffer size of this window
+func (w *glfwWindow) FramebufferSize() (width int, height int) {
+
+	return w.win.GetFramebufferSize()
+}
+
 // SetSize sets the size, in screen coordinates, of the client area of this window
 // SetSize sets the size, in screen coordinates, of the client area of this window
 func (w *glfwWindow) SetSize(width int, height int) {
 func (w *glfwWindow) SetSize(width int, height int) {
 
 
@@ -339,3 +345,17 @@ func (w *glfwWindow) SetStandardCursor(cursor StandardCursor) {
 		panic("Invalid cursor")
 		panic("Invalid cursor")
 	}
 	}
 }
 }
+
+// SetInputMode changes specified input to specified state
+// Reference: http://www.glfw.org/docs/latest/group__input.html#gaa92336e173da9c8834558b54ee80563b
+func (w *glfwWindow) SetInputMode(mode InputMode, state int) {
+
+	w.win.SetInputMode(glfw.InputMode(mode), state)
+}
+
+// SetCursorPos sets cursor position in window coordinates
+// Reference: http://www.glfw.org/docs/latest/group__input.html#ga04b03af936d906ca123c8f4ee08b39e7
+func (w *glfwWindow) SetCursorPos(xpos, ypos float64) {
+
+	w.win.SetCursorPos(xpos, ypos)
+}

+ 3 - 0
window/window.go

@@ -24,12 +24,15 @@ type IWindowManager interface {
 type IWindow interface {
 type IWindow interface {
 	core.IDispatcher
 	core.IDispatcher
 	MakeContextCurrent()
 	MakeContextCurrent()
+	FramebufferSize() (width int, height int)
 	Size() (width int, height int)
 	Size() (width int, height int)
 	SetSize(width int, height int)
 	SetSize(width int, height int)
 	Pos() (xpos, ypos int)
 	Pos() (xpos, ypos int)
 	SetPos(xpos, ypos int)
 	SetPos(xpos, ypos int)
 	SetTitle(title string)
 	SetTitle(title string)
 	SetStandardCursor(cursor StandardCursor)
 	SetStandardCursor(cursor StandardCursor)
+	SetInputMode(mode InputMode, state int)
+	SetCursorPos(xpos, ypos float64)
 	ShouldClose() bool
 	ShouldClose() bool
 	SetShouldClose(bool)
 	SetShouldClose(bool)
 	FullScreen() bool
 	FullScreen() bool