diff --git a/internal/glfw/const.go b/internal/glfw/const.go new file mode 100644 index 000000000..a8ce6a24c --- /dev/null +++ b/internal/glfw/const.go @@ -0,0 +1,79 @@ +// Copyright 2018 The Ebiten Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package glfw + +const ( + False = 0 + True = 1 +) + +const ( + Release = Action(0) + Press = Action(1) + Repeat = Action(2) +) + +const ( + ModShift = ModifierKey(0x0001) + ModControl = ModifierKey(0x0002) + ModAlt = ModifierKey(0x0004) +) + +const ( + MouseButtonLeft = MouseButton(0) + MouseButtonRight = MouseButton(1) + MouseButtonMiddle = MouseButton(2) +) + +const ( + Joystick1 = Joystick(0) + Joystick2 = Joystick(1) + Joystick3 = Joystick(2) + Joystick4 = Joystick(3) + Joystick5 = Joystick(4) + Joystick6 = Joystick(5) + Joystick7 = Joystick(6) + Joystick8 = Joystick(7) + Joystick9 = Joystick(8) + Joystick10 = Joystick(9) + Joystick11 = Joystick(10) + Joystick12 = Joystick(11) + Joystick13 = Joystick(12) + Joystick14 = Joystick(13) + Joystick15 = Joystick(14) + Joystick16 = Joystick(15) +) + +const ( + ClientAPI = Hint(0x00022001) + ContextVersionMajor = Hint(0x00022002) + ContextVersionMinor = Hint(0x00022003) + Decorated = Hint(0x00020005) + Focused = Hint(0x00020001) + Resizable = Hint(0x00020003) + Visible = Hint(0x00020004) +) + +const ( + CursorMode = InputMode(0x00033001) + StickyKeysMode = InputMode(0x00033002) + StickyMouseButtonsMode = InputMode(0x00033003) +) + +const ( + CursorHidden = 0x00034002 + CursorNormal = 0x00034001 + NoAPI = 0 +) diff --git a/internal/glfw/glfw.go b/internal/glfw/glfw.go index a5b119e5c..af8ac3e9c 100644 --- a/internal/glfw/glfw.go +++ b/internal/glfw/glfw.go @@ -19,5 +19,33 @@ import ( ) type ( - Key = glfw.Key + Action = glfw.Action + Hint = glfw.Hint + InputMode = glfw.InputMode + Joystick = glfw.Joystick + Key = glfw.Key + ModifierKey = glfw.ModifierKey + MouseButton = glfw.MouseButton + MonitorEvent = glfw.MonitorEvent +) + +type ( + Monitor = glfw.Monitor + VidMode = glfw.VidMode + Window = glfw.Window +) + +var ( + CreateWindow = glfw.CreateWindow + GetJoystickAxes = glfw.GetJoystickAxes + GetJoystickButtons = glfw.GetJoystickButtons + GetMonitors = glfw.GetMonitors + GetPrimaryMonitor = glfw.GetPrimaryMonitor + Init = glfw.Init + JoystickPresent = glfw.JoystickPresent + PollEvents = glfw.PollEvents + SetMonitorCallback = glfw.SetMonitorCallback + SwapInterval = glfw.SwapInterval + Terminate = glfw.Terminate + WindowHint = glfw.WindowHint ) diff --git a/internal/input/input_glfw.go b/internal/input/input_glfw.go index c952604ea..62d09f579 100644 --- a/internal/input/input_glfw.go +++ b/internal/input/input_glfw.go @@ -23,7 +23,7 @@ import ( "sync" "unicode" - glfw "github.com/go-gl/glfw/v3.2/glfw" + "github.com/hajimehoshi/ebiten/internal/glfw" ) type Input struct { diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index b00697877..e2019f43b 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -26,9 +26,8 @@ import ( "sync" "time" - "github.com/go-gl/glfw/v3.2/glfw" - "github.com/hajimehoshi/ebiten/internal/devicescale" + "github.com/hajimehoshi/ebiten/internal/glfw" "github.com/hajimehoshi/ebiten/internal/graphicscommand" "github.com/hajimehoshi/ebiten/internal/hooks" "github.com/hajimehoshi/ebiten/internal/input" diff --git a/internal/ui/ui_mac.go b/internal/ui/ui_mac.go index a38941818..29344af5b 100644 --- a/internal/ui/ui_mac.go +++ b/internal/ui/ui_mac.go @@ -45,7 +45,7 @@ import "C" import ( "unsafe" - "github.com/go-gl/glfw/v3.2/glfw" + "github.com/hajimehoshi/ebiten/internal/glfw" ) func glfwScale() float64 { diff --git a/internal/ui/ui_unix.go b/internal/ui/ui_unix.go index 52604c21f..182606a3f 100644 --- a/internal/ui/ui_unix.go +++ b/internal/ui/ui_unix.go @@ -19,9 +19,8 @@ package ui import ( - "github.com/go-gl/glfw/v3.2/glfw" - "github.com/hajimehoshi/ebiten/internal/devicescale" + "github.com/hajimehoshi/ebiten/internal/glfw" ) func glfwScale() float64 { diff --git a/internal/ui/ui_windows.go b/internal/ui/ui_windows.go index dd984a6b9..b2a70d8cf 100644 --- a/internal/ui/ui_windows.go +++ b/internal/ui/ui_windows.go @@ -21,9 +21,8 @@ import ( "syscall" "unsafe" - "github.com/go-gl/glfw/v3.2/glfw" - "github.com/hajimehoshi/ebiten/internal/devicescale" + "github.com/hajimehoshi/ebiten/internal/glfw" ) const (