Merge pull request #211 from zergon321/add-glfw-v33
pixelgl has been ported to GLFW 3.3.
This commit is contained in:
commit
197e604220
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
|||
github.com/faiface/glhf v0.0.0-20181018222622-82a6317ac380
|
||||
github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 // indirect
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72
|
||||
github.com/go-gl/mathgl v0.0.0-20190416160123-c4601bc793c7
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||
github.com/pkg/errors v0.8.1
|
||||
|
|
4
go.sum
4
go.sum
|
@ -6,8 +6,8 @@ github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3 h1:baVdMKlASEHr
|
|||
github.com/faiface/mainthread v0.0.0-20171120011319-8b78f0a41ae3/go.mod h1:VEPNJUlxl5KdWjDvz6Q1l+rJlxF2i6xqDeGuGAxa87M=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72 h1:b+9H1GAsx5RsjvDFLoS5zkNBzIQMuVKUYQDmxU3N5XE=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/mathgl v0.0.0-20190416160123-c4601bc793c7 h1:THttjeRn1iiz69E875U6gAik8KTWk/JYAHoSVpUxBBI=
|
||||
github.com/go-gl/mathgl v0.0.0-20190416160123-c4601bc793c7/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||
|
|
|
@ -3,7 +3,7 @@ package pixelgl
|
|||
import (
|
||||
"github.com/faiface/mainthread"
|
||||
"github.com/faiface/pixel"
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
"github.com/go-gl/glfw/v3.3/glfw"
|
||||
)
|
||||
|
||||
// Pressed returns whether the Button is currently pressed down.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package pixelgl
|
||||
|
||||
import (
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
"github.com/go-gl/glfw/v3.3/glfw"
|
||||
)
|
||||
|
||||
// Joystick is a joystick or controller.
|
||||
|
@ -94,22 +94,22 @@ func (w *Window) JoystickAxis(js Joystick, axis int) float64 {
|
|||
func (w *Window) updateJoystickInput() {
|
||||
for js := Joystick1; js <= JoystickLast; js++ {
|
||||
// Determine and store if the joystick was connected
|
||||
joystickPresent := glfw.JoystickPresent(glfw.Joystick(js))
|
||||
joystickPresent := glfw.Joystick(js).Present()
|
||||
w.tempJoy.connected[js] = joystickPresent
|
||||
|
||||
if joystickPresent {
|
||||
w.tempJoy.buttons[js] = glfw.GetJoystickButtons(glfw.Joystick(js))
|
||||
w.tempJoy.axis[js] = glfw.GetJoystickAxes(glfw.Joystick(js))
|
||||
w.tempJoy.buttons[js] = glfw.Joystick(js).GetButtons()
|
||||
w.tempJoy.axis[js] = glfw.Joystick(js).GetAxes()
|
||||
|
||||
if !w.currJoy.connected[js] {
|
||||
// The joystick was recently connected, we get the name
|
||||
w.tempJoy.name[js] = glfw.GetJoystickName(glfw.Joystick(js))
|
||||
w.tempJoy.name[js] = glfw.Joystick(js).GetName()
|
||||
} else {
|
||||
// Use the name from the previous one
|
||||
w.tempJoy.name[js] = w.currJoy.name[js]
|
||||
}
|
||||
} else {
|
||||
w.tempJoy.buttons[js] = []byte{}
|
||||
w.tempJoy.buttons[js] = []glfw.Action{}
|
||||
w.tempJoy.axis[js] = []float32{}
|
||||
w.tempJoy.name[js] = ""
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ func (w *Window) updateJoystickInput() {
|
|||
type joystickState struct {
|
||||
connected [JoystickLast + 1]bool
|
||||
name [JoystickLast + 1]string
|
||||
buttons [JoystickLast + 1][]byte
|
||||
buttons [JoystickLast + 1][]glfw.Action
|
||||
axis [JoystickLast + 1][]float32
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package pixelgl
|
|||
|
||||
import (
|
||||
"github.com/faiface/mainthread"
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
"github.com/go-gl/glfw/v3.3/glfw"
|
||||
)
|
||||
|
||||
// Monitor represents a physical display attached to your computer.
|
||||
|
|
|
@ -2,7 +2,7 @@ package pixelgl
|
|||
|
||||
import (
|
||||
"github.com/faiface/mainthread"
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
"github.com/go-gl/glfw/v3.3/glfw"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/faiface/glhf"
|
||||
"github.com/faiface/mainthread"
|
||||
"github.com/faiface/pixel"
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
"github.com/go-gl/glfw/v3.3/glfw"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue