ebiten: github.com/hajimehoshi/ebiten/internal/driver Index | Files

package driver

import "github.com/hajimehoshi/ebiten/internal/driver"

Index

Package Files

compositemode.go event.go filter.go gamepadbutton.go graphics.go input.go keys.go modifier.go mousebutton.go ui.go

Variables

var IsPlayground = time.Now().UnixNano() == 1257894000000000000

IsPlayground indicates whether the current environment is the Go Playground (play.golang.org) or not. The fixed time is explicitly defined. See "About the Playground" at play.golang.org.

var RegularTermination = errors.New("regular termination")

RegularTermination represents a regular termination. Run can return this error, and if this error is received, the game loop should be terminated as soon as possible.

type Address Uses

type Address int
const (
    AddressClampToZero Address = iota
    AddressRepeat
)

type CompositeMode Uses

type CompositeMode int
const (
    CompositeModeUnknown    CompositeMode = iota - 1
    CompositeModeSourceOver               // This value must be 0 (= initial value)
    CompositeModeClear
    CompositeModeCopy
    CompositeModeDestination
    CompositeModeDestinationOver
    CompositeModeSourceIn
    CompositeModeDestinationIn
    CompositeModeSourceOut
    CompositeModeDestinationOut
    CompositeModeSourceAtop
    CompositeModeDestinationAtop
    CompositeModeXor
    CompositeModeLighter

    CompositeModeMax = CompositeModeLighter
)

func (CompositeMode) Operations Uses

func (c CompositeMode) Operations() (src Operation, dst Operation)

type Event Uses

type Event interface{}

type Filter Uses

type Filter int
const (
    FilterNearest Filter = iota + 1 // TODO: Remove '+ 1' when ebiten.FilterDefault can be removed.
    FilterLinear
    FilterScreen
)

type GamepadAttach Uses

type GamepadAttach struct {
    // ID represents which gamepad caused the event.
    ID  int

    // Axes represents the amount of axes the gamepad has.
    Axes int

    // Buttons represents the amount of buttons the gamepad has.
    Buttons int
}

GamepadAttach happens when a new gamepad is attached.

type GamepadAxis Uses

type GamepadAxis struct {
    // ID represents which gamepad caused the event.
    ID  int

    // Axis is the axis of the game pad that changed position.
    Axis int

    // Position is the position of the axis after the change. It varies between -1.0 and 1.0.
    Position float32
}

GamepadAxis is for event where an axis on a gamepad changes.

type GamepadButton Uses

type GamepadButton int
const (
    GamepadButton0 GamepadButton = iota
    GamepadButton1
    GamepadButton2
    GamepadButton3
    GamepadButton4
    GamepadButton5
    GamepadButton6
    GamepadButton7
    GamepadButton8
    GamepadButton9
    GamepadButton10
    GamepadButton11
    GamepadButton12
    GamepadButton13
    GamepadButton14
    GamepadButton15
    GamepadButton16
    GamepadButton17
    GamepadButton18
    GamepadButton19
    GamepadButton20
    GamepadButton21
    GamepadButton22
    GamepadButton23
    GamepadButton24
    GamepadButton25
    GamepadButton26
    GamepadButton27
    GamepadButton28
    GamepadButton29
    GamepadButton30
    GamepadButton31
)

type GamepadButtonDown Uses

type GamepadButtonDown struct {
    // ID represents which gamepad caused the event.
    ID  int

    // Button is the button that was pressed on the game pad.
    Button int

    // Pressure is the pressure that is applied to the gamepad button. It varies between 0.0 for not pressed, and 1.0 for completely pressed.
    Pressure float32
}

GamepadButtonDown is a gamepad button press event.

type GamepadButtonUp Uses

type GamepadButtonUp struct {
    // ID represents which gamepad caused the event.
    ID  int

    // Button is the button that was pressed on the game pad.
    Button int

    // Pressure is the pressure that is applied to the gamepad button. It varies between 0.0 for not pressed, and 1.0 for completely pressed.
    Pressure float32
}

GamepadButtonUp is a gamepad button release event.

type GamepadDetach Uses

type GamepadDetach struct {
    // ID represents which gamepad caused the event.
    ID int
}

GamepadDetach happens when a gamepad is detached.

type Graphics Uses

type Graphics interface {
    SetThread(thread *thread.Thread)
    Begin()
    End()
    SetWindow(window uintptr)
    SetVertices(vertices []float32, indices []uint16)
    Flush()
    NewImage(width, height int) (Image, error)
    NewScreenFramebufferImage(width, height int) (Image, error)
    Reset() error
    Draw(indexLen int, indexOffset int, mode CompositeMode, colorM *affine.ColorM, filter Filter, address Address) error
    SetVsyncEnabled(enabled bool)
    VDirection() VDirection
    NeedsRestoring() bool
    IsGL() bool
    HasHighPrecisionFloat() bool
    MaxImageSize() int
}

type Image Uses

type Image interface {
    Dispose()
    IsInvalidated() bool
    Pixels() ([]byte, error)
    SetAsDestination()
    SetAsSource()
    ReplacePixels(pixels []byte, x, y, width, height int)
}

type Input Uses

type Input interface {
    CursorPosition() (x, y int)
    GamepadAxis(id int, axis int) float64
    GamepadAxisNum(id int) int
    GamepadButtonNum(id int) int
    GamepadIDs() []int
    IsGamepadButtonPressed(id int, button GamepadButton) bool
    IsKeyPressed(key Key) bool
    IsMouseButtonPressed(button MouseButton) bool
    ResetForFrame()
    RuneBuffer() []rune
    TouchIDs() []int
    TouchPosition(id int) (x, y int)
    Wheel() (xoff, yoff float64)
}

type Key Uses

type Key int
const (
    Key0 Key = iota
    Key1
    Key2
    Key3
    Key4
    Key5
    Key6
    Key7
    Key8
    Key9
    KeyA
    KeyB
    KeyC
    KeyD
    KeyE
    KeyF
    KeyG
    KeyH
    KeyI
    KeyJ
    KeyK
    KeyL
    KeyM
    KeyN
    KeyO
    KeyP
    KeyQ
    KeyR
    KeyS
    KeyT
    KeyU
    KeyV
    KeyW
    KeyX
    KeyY
    KeyZ
    KeyApostrophe
    KeyBackslash
    KeyBackspace
    KeyCapsLock
    KeyComma
    KeyDelete
    KeyDown
    KeyEnd
    KeyEnter
    KeyEqual
    KeyEscape
    KeyF1
    KeyF2
    KeyF3
    KeyF4
    KeyF5
    KeyF6
    KeyF7
    KeyF8
    KeyF9
    KeyF10
    KeyF11
    KeyF12
    KeyGraveAccent
    KeyHome
    KeyInsert
    KeyKP0
    KeyKP1
    KeyKP2
    KeyKP3
    KeyKP4
    KeyKP5
    KeyKP6
    KeyKP7
    KeyKP8
    KeyKP9
    KeyKPAdd
    KeyKPDecimal
    KeyKPDivide
    KeyKPEnter
    KeyKPEqual
    KeyKPMultiply
    KeyKPSubtract
    KeyLeft
    KeyLeftAlt
    KeyLeftBracket
    KeyLeftControl
    KeyLeftShift
    KeyMenu
    KeyMinus
    KeyNumLock
    KeyPageDown
    KeyPageUp
    KeyPause
    KeyPeriod
    KeyPrintScreen
    KeyRight
    KeyRightAlt
    KeyRightBracket
    KeyRightControl
    KeyRightShift
    KeyScrollLock
    KeySemicolon
    KeySlash
    KeySpace
    KeyTab
    KeyUp
    KeyReserved0
    KeyReserved1
    KeyReserved2
)

type KeyboardKeyCharacter Uses

type KeyboardKeyCharacter struct {
    // Key is the key code of the key typed.
    Key Key

    // Modifier is the logical-or value of the modifiers pressed together with the key.
    Modifier Modifier

    // Character is the character that was typed.
    Character rune
}

KeyboardKeyCharacter is an event that occurs when a character is actually typed on the keyboard. This may be provided by an input method.

type KeyboardKeyDown Uses

type KeyboardKeyDown struct {
    // Key is the key code of the key pressed or released.
    Key Key

    // Modifier is the logical-or value of the modifiers pressed together with the key.
    Modifier Modifier
}

KeyboardKeyDown is an event that occurs when a key is pressed on the keyboard.

type KeyboardKeyUp Uses

type KeyboardKeyUp struct {
    // Key is the key code of the key pressed or released.
    Key Key

    // Modifier is the logical-or value of the modifiers pressed together with the key.
    Modifier Modifier
}

KeyboardKeyUp is an event that occurs when a key is released on the keyboard.

type Modifier Uses

type Modifier int
const (
    ModifierShift Modifier = 1 << iota
    ModifierControl
    ModifierAlt
    ModifierCapsLock
    ModifierNumLock
)

type MouseButton Uses

type MouseButton int
const (
    MouseButtonLeft MouseButton = iota
    MouseButtonRight
    MouseButtonMiddle
)

type MouseButtonDown Uses

type MouseButtonDown struct {
    // X is the X position of the mouse pointer. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the mouse pointer. This value is expressed in device independent pixels.
    Y   float32

    // Button is the button on the mouse that was pressed. TODO: this should change later from an int to an enumeration type.
    Button int

    // Pressure is the pressure applied on the mouse button. It varies between 0.0 for not pressed, and 1.0 for completely pressed.
    Pressure float32
}

MouseButtonDown is a mouse button press event.

type MouseButtonUp Uses

type MouseButtonUp struct {
    // X is the X position of the mouse pointer. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the mouse pointer. This value is expressed in device independent pixels.
    Y   float32

    // Button is the button on the mouse that was pressed. TODO: this should change later from an int to an enumeration type.
    Button int

    // Pressure is the pressure applied on the mouse button. It varies between 0.0 for not pressed, and 1.0 for completely pressed.
    Pressure float32
}

MouseButtonUp is a mouse button release event.

type MouseEnter Uses

type MouseEnter struct {
    // X is the X position of the mouse pointer. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the mouse pointer. This value is expressed in device independent pixels.
    Y   float32
}

MouseEnter occurs when the mouse enters the view window.

type MouseLeave Uses

type MouseLeave struct {
    // X is the X position of the mouse pointer. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the mouse pointer. This value is expressed in device independent pixels.
    Y   float32
}

MouseLeave occurs when the mouse leaves the view window.

type MouseMove Uses

type MouseMove struct {
    // X is the X position of the mouse pointer. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the mouse pointer. This value is expressed in device independent pixels.
    Y   float32

    // DeltaX is the change in X since the last MouseMove event. This value is expressed in device independent pixels.
    DeltaX float32

    // DeltaY is the change in Y since the last MouseMove event. This value is expressed in device independent pixels.
    DeltaY float32
}

MouseMove is a mouse movement event.

type MouseWheel Uses

type MouseWheel struct {
    // X is the X position of the mouse wheel. This value is expressed in arbitrary units. It increases when the mouse wheel is scrolled downwards, and decreases when the mouse is scrolled upwards.
    X   float32

    // Y is the Y position of the mouse wheel. This value is expressed in arbitrary units. It increases when the mouse wheel is scrolled to the right, and decreases when the mouse is scrolled to the left.
    Y   float32

    // DeltaX is the change in X since the last MouseWheel event. This value is expressed in arbitrary units. It is positive when the mouse wheel is scrolled downwards, and negative when the mouse is scrolled upwards.
    DeltaX float32

    // DeltaY is the change in Y since the last MouseWheel event. This value is expressed in arbitrary units. It is positive when the mouse wheel is scrolled to the right, and negative when the mouse is scrolled to the left.
    DeltaY float32
}

MouseWheel is a mouse wheel event.

type Operation Uses

type Operation int
const (
    Zero Operation = iota
    One
    SrcAlpha
    DstAlpha
    OneMinusSrcAlpha
    OneMinusDstAlpha
)

type TouchBegin Uses

type TouchBegin struct {
    // ID identifies the touch that caused the touch event.
    ID  int

    // X is the X position of the touch. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the touch. This value is expressed in device independent pixels.
    Y   float32

    // DeltaX is the change in X since last touch event. This value is expressed in device independent pixels.
    DeltaX float32

    // Deltay is the change in Y since last touch event. This value is expressed in device independent pixels.
    Deltay float32

    // Pressure of applied touch. It varies between 0.0 for not pressed, and 1.0 for completely pressed.
    Pressure float32

    // Primary represents whether the touch event is the primary touch or not. If it is true, then it is a primary touch. If it is false then it is not.
    Primary bool
}

TouchBegin occurs when a touch begins.

type TouchCancel Uses

type TouchCancel struct {
    // ID identifies the touch that caused the touch event.
    ID int
}

TouchCancel occurs when a touch is canceled. This can happen in various situations, depending on the underlying platform, for example when the application loses focus.

type TouchEnd Uses

type TouchEnd struct {
    // ID identifies the touch that caused the touch event.
    ID  int

    // X is the X position of the touch. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the touch. This value is expressed in device independent pixels.
    Y   float32

    // DeltaX is the change in X since last touch event. This value is expressed in device independent pixels.
    DeltaX float32

    // Deltay is the change in Y since last touch event. This value is expressed in device independent pixels.
    Deltay float32

    // Pressure of applied touch. It varies between 0.0 for not pressed, and 1.0 for completely pressed.
    Pressure float32

    // Primary represents whether the touch event is the primary touch or not. If it is true, then it is a primary touch. If it is false then it is not.
    Primary bool
}

TouchEnd occurs when a touch ends.

type TouchMove Uses

type TouchMove struct {
    // ID identifies the touch that caused the touch event.
    ID  int

    // X is the X position of the touch. This value is expressed in device independent pixels.
    X   float32

    // Y is the Y position of the touch. This value is expressed in device independent pixels.
    Y   float32

    // DeltaX is the change in X since last touch event. This value is expressed in device independent pixels.
    DeltaX float32

    // Deltay is the change in Y since last touch event. This value is expressed in device independent pixels.
    Deltay float32

    // Pressure of applied touch. It varies between 0.0 for not pressed, and 1.0 for completely pressed.
    Pressure float32

    // Primary represents whether the touch event is the primary touch or not. If it is true, then it is a primary touch. If it is false then it is not.
    Primary bool
}

TouchMove occurs when a touch moved, or in other words, is dragged.

type UI Uses

type UI interface {
    DeviceScaleFactor() float64
    IsCursorVisible() bool
    IsFullscreen() bool
    IsRunnableInBackground() bool
    IsVsyncEnabled() bool
    IsWindowDecorated() bool
    IsWindowResizable() bool
    Run(width, height int, scale float64, title string, context UIContext, graphics Graphics) error
    RunWithoutMainLoop(width, height int, scale float64, title string, context UIContext, graphics Graphics) <-chan error
    ScreenPadding() (x0, y0, x1, y1 float64)
    ScreenScale() float64
    ScreenSizeInFullscreen() (int, int)
    SetCursorVisible(visible bool)
    SetFullscreen(fullscreen bool)
    SetRunnableInBackground(runnableInBackground bool)
    SetScreenScale(scale float64)
    SetScreenSize(width, height int)
    SetVsyncEnabled(enabled bool)
    SetWindowDecorated(decorated bool)
    SetWindowIcon(iconImages []image.Image)
    SetWindowResizable(resizable bool)
    SetWindowTitle(title string)
    Input() Input
}

type UIContext Uses

type UIContext interface {
    SetSize(width, height int, scale float64)
    Update(afterFrameUpdate func()) error
    SuspendAudio()
    ResumeAudio()
}

type VDirection Uses

type VDirection int
const (
    VUpward VDirection = iota
    VDownward
)

type ViewSize Uses

type ViewSize struct {
    // Width is the width of the view. This value is expressed in device independent pixels.
    Width int

    // Height is the height of the view. This value is expressed in device independent pixels.
    Height int
}

ViewSize occurs when the size of the application's view port changes.

type ViewUpdate Uses

type ViewUpdate struct {
}

ViewUpdate occurs when the application is ready to update the next frame on the view port.

Package driver imports 6 packages (graph) and is imported by 10 packages. Updated 2019-10-11. Refresh now. Tools for package owners.