const.go (3502B)
1 // Copyright 2018 The Ebiten Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // +build !js 16 17 package glfw 18 19 import ( 20 "fmt" 21 ) 22 23 type ( 24 Action int 25 ErrorCode int 26 Hint int 27 InputMode int 28 Joystick int 29 Key int 30 ModifierKey int 31 MouseButton int 32 PeripheralEvent int 33 ) 34 35 const ( 36 False = 0 37 True = 1 38 ) 39 40 const ( 41 Release = Action(0) 42 Press = Action(1) 43 Repeat = Action(2) 44 ) 45 46 const ( 47 ModShift = ModifierKey(0x0001) 48 ModControl = ModifierKey(0x0002) 49 ModAlt = ModifierKey(0x0004) 50 ) 51 52 const ( 53 MouseButtonLeft = MouseButton(0) 54 MouseButtonRight = MouseButton(1) 55 MouseButtonMiddle = MouseButton(2) 56 ) 57 58 const ( 59 Joystick1 = Joystick(0) 60 Joystick2 = Joystick(1) 61 Joystick3 = Joystick(2) 62 Joystick4 = Joystick(3) 63 Joystick5 = Joystick(4) 64 Joystick6 = Joystick(5) 65 Joystick7 = Joystick(6) 66 Joystick8 = Joystick(7) 67 Joystick9 = Joystick(8) 68 Joystick10 = Joystick(9) 69 Joystick11 = Joystick(10) 70 Joystick12 = Joystick(11) 71 Joystick13 = Joystick(12) 72 Joystick14 = Joystick(13) 73 Joystick15 = Joystick(14) 74 Joystick16 = Joystick(15) 75 ) 76 77 const ( 78 ClientAPI = Hint(0x00022001) 79 ContextVersionMajor = Hint(0x00022002) 80 ContextVersionMinor = Hint(0x00022003) 81 Decorated = Hint(0x00020005) 82 Floating = Hint(0x00020007) 83 Focused = Hint(0x00020001) 84 FocusOnShow = Hint(0x0002000C) 85 Iconified = Hint(0x00020002) 86 Maximized = Hint(0x00020008) 87 Resizable = Hint(0x00020003) 88 TransparentFramebuffer = Hint(0x0002000A) 89 Visible = Hint(0x00020004) 90 ) 91 92 const ( 93 CursorMode = InputMode(0x00033001) 94 StickyKeysMode = InputMode(0x00033002) 95 StickyMouseButtonsMode = InputMode(0x00033003) 96 ) 97 98 const ( 99 CursorDisabled = 0x00034003 100 CursorHidden = 0x00034002 101 CursorNormal = 0x00034001 102 NoAPI = 0 103 OpenGLAPI = 0x00030001 104 ) 105 106 const ( 107 NotInitialized = ErrorCode(0x00010001) 108 NoCurrentContext = ErrorCode(0x00010002) 109 InvalidEnum = ErrorCode(0x00010003) 110 InvalidValue = ErrorCode(0x00010004) 111 OutOfMemory = ErrorCode(0x00010005) 112 APIUnavailable = ErrorCode(0x00010006) 113 VersionUnavailable = ErrorCode(0x00010007) 114 PlatformError = ErrorCode(0x00010008) 115 FormatUnavailable = ErrorCode(0x00010009) 116 NoWindowContext = ErrorCode(0x0001000A) 117 ) 118 119 func (e ErrorCode) String() string { 120 switch e { 121 case NotInitialized: 122 return "not initialized" 123 case NoCurrentContext: 124 return "no current context" 125 case InvalidEnum: 126 return "invalid enum" 127 case InvalidValue: 128 return "invalid value" 129 case OutOfMemory: 130 return "out of memory" 131 case APIUnavailable: 132 return "API unavailable" 133 case VersionUnavailable: 134 return "version unavailable" 135 case PlatformError: 136 return "platform error" 137 case FormatUnavailable: 138 return "format unavailable" 139 case NoWindowContext: 140 return "no window context" 141 default: 142 return fmt.Sprintf("GLFW error code (%d)", e) 143 } 144 }