zorldo

Goofing around with Ebiten
git clone git://bsandro.tech/zorldo
Log | Files | Refs | README

const.go (4246B)


      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 //go:build !js
     16 // +build !js
     17 
     18 package glfw
     19 
     20 import (
     21 	"fmt"
     22 )
     23 
     24 type (
     25 	Action           int
     26 	ErrorCode        int
     27 	Hint             int
     28 	InputMode        int
     29 	Joystick         int
     30 	JoystickHatState int
     31 	Key              int
     32 	ModifierKey      int
     33 	MouseButton      int
     34 	PeripheralEvent  int
     35 	StandardCursor   int
     36 )
     37 
     38 const (
     39 	DontCare = -1
     40 	False    = 0
     41 	True     = 1
     42 )
     43 
     44 const (
     45 	Release = Action(0)
     46 	Press   = Action(1)
     47 	Repeat  = Action(2)
     48 )
     49 
     50 const (
     51 	ModShift   = ModifierKey(0x0001)
     52 	ModControl = ModifierKey(0x0002)
     53 	ModAlt     = ModifierKey(0x0004)
     54 )
     55 
     56 const (
     57 	MouseButtonLeft   = MouseButton(0)
     58 	MouseButtonRight  = MouseButton(1)
     59 	MouseButtonMiddle = MouseButton(2)
     60 )
     61 
     62 const (
     63 	Joystick1  = Joystick(0)
     64 	Joystick2  = Joystick(1)
     65 	Joystick3  = Joystick(2)
     66 	Joystick4  = Joystick(3)
     67 	Joystick5  = Joystick(4)
     68 	Joystick6  = Joystick(5)
     69 	Joystick7  = Joystick(6)
     70 	Joystick8  = Joystick(7)
     71 	Joystick9  = Joystick(8)
     72 	Joystick10 = Joystick(9)
     73 	Joystick11 = Joystick(10)
     74 	Joystick12 = Joystick(11)
     75 	Joystick13 = Joystick(12)
     76 	Joystick14 = Joystick(13)
     77 	Joystick15 = Joystick(14)
     78 	Joystick16 = Joystick(15)
     79 )
     80 
     81 const (
     82 	AutoIconify            = Hint(0x00020006)
     83 	ClientAPI              = Hint(0x00022001)
     84 	ContextVersionMajor    = Hint(0x00022002)
     85 	ContextVersionMinor    = Hint(0x00022003)
     86 	Decorated              = Hint(0x00020005)
     87 	Floating               = Hint(0x00020007)
     88 	Focused                = Hint(0x00020001)
     89 	FocusOnShow            = Hint(0x0002000C)
     90 	Iconified              = Hint(0x00020002)
     91 	Maximized              = Hint(0x00020008)
     92 	Resizable              = Hint(0x00020003)
     93 	TransparentFramebuffer = Hint(0x0002000A)
     94 	Visible                = Hint(0x00020004)
     95 )
     96 
     97 const (
     98 	CursorMode             = InputMode(0x00033001)
     99 	StickyKeysMode         = InputMode(0x00033002)
    100 	StickyMouseButtonsMode = InputMode(0x00033003)
    101 )
    102 
    103 const (
    104 	CursorDisabled = 0x00034003
    105 	CursorHidden   = 0x00034002
    106 	CursorNormal   = 0x00034001
    107 	NoAPI          = 0
    108 	OpenGLAPI      = 0x00030001
    109 )
    110 
    111 const (
    112 	NotInitialized     = ErrorCode(0x00010001)
    113 	NoCurrentContext   = ErrorCode(0x00010002)
    114 	InvalidEnum        = ErrorCode(0x00010003)
    115 	InvalidValue       = ErrorCode(0x00010004)
    116 	OutOfMemory        = ErrorCode(0x00010005)
    117 	APIUnavailable     = ErrorCode(0x00010006)
    118 	VersionUnavailable = ErrorCode(0x00010007)
    119 	PlatformError      = ErrorCode(0x00010008)
    120 	FormatUnavailable  = ErrorCode(0x00010009)
    121 	NoWindowContext    = ErrorCode(0x0001000A)
    122 )
    123 
    124 func (e ErrorCode) String() string {
    125 	switch e {
    126 	case NotInitialized:
    127 		return "not initialized"
    128 	case NoCurrentContext:
    129 		return "no current context"
    130 	case InvalidEnum:
    131 		return "invalid enum"
    132 	case InvalidValue:
    133 		return "invalid value"
    134 	case OutOfMemory:
    135 		return "out of memory"
    136 	case APIUnavailable:
    137 		return "API unavailable"
    138 	case VersionUnavailable:
    139 		return "version unavailable"
    140 	case PlatformError:
    141 		return "platform error"
    142 	case FormatUnavailable:
    143 		return "format unavailable"
    144 	case NoWindowContext:
    145 		return "no window context"
    146 	default:
    147 		return fmt.Sprintf("GLFW error code (%d)", e)
    148 	}
    149 }
    150 
    151 const (
    152 	ArrowCursor     = StandardCursor(0x00036001)
    153 	IBeamCursor     = StandardCursor(0x00036002)
    154 	CrosshairCursor = StandardCursor(0x00036003)
    155 	HandCursor      = StandardCursor(0x00036004)
    156 	HResizeCursor   = StandardCursor(0x00036005)
    157 	VResizeCursor   = StandardCursor(0x00036006)
    158 )
    159 
    160 const (
    161 	HatCentered  = JoystickHatState(0)
    162 	HatUp        = JoystickHatState(1)
    163 	HatRight     = JoystickHatState(2)
    164 	HatDown      = JoystickHatState(4)
    165 	HatLeft      = JoystickHatState(8)
    166 	HatRightUp   = HatRight | HatUp
    167 	HatRightDown = HatRight | HatDown
    168 	HatLeftUp    = HatLeft | HatUp
    169 	HatLeftDown  = HatLeft | HatDown
    170 )