Skip to content
Tangent 128 edited this page Mar 28, 2015 · 3 revisions

Event

  • Event
    • Table
      • SYNOPSIS
      • FIELDS
        • WindowEvent
        • KeyDown, KeyUp
        • TextEditing
        • TextInput
        • MouseMotion
        • MouseButtonDown, MouseButtonUp
        • MouseWheel
        • JoyAxisMotion
        • JoyBallMotion
        • JoyHatMotion
        • JoyButtonDown, JoyButtonUp
        • JoyDeviceAdded, JoyDeviceRemoved

This is the table used for handling events. Fields are dynamically set depending on the type of event.

Table

SYNOPSIS

local event = {
type,
    ...
}

FIELDS

  • type, the type of the event (see SDL.event)
  • ..., the other fields defined for the specific event type

WindowEvent

  • windowID, the window id
  • event, the type of window event (see SDL.eventWindow)

KeyDown, KeyUp

  • windowID, the window id
  • state, the button state
  • repeat, the repeat state
  • keysym, a table

TextEditing

  • windowID, the window id
  • text, the text as string
  • start, the location to begin editing from as integer
  • length, length of text as integer

TextInput

  • windowID, the window id
  • text, the UTF-8 string text

MouseMotion

  • windowID, the window id
  • x, x coordinate, relative to window
  • y, y coordinate, relative to window
  • xrel, relative motion in the x direction
  • yrel, relative motion in the y direction
  • which, the instance id
  • state, a table enumeration of all buttons pressed (see [[SDL-MouseMask|SDL.mouseMask)

MouseButtonDown, MouseButtonUp

  • windowID, the window id
  • x, x coordinate, relative to window
  • y, y coordinate, relative to window
  • button, the mouse button (see SDL.mouseButton)
  • state, true if pressed

MouseWheel

  • windowID, the window id
  • which, which wheel
  • x, the amount scrolled horizontally
  • y, the amount scrolled vertically

JoyAxisMotion

  • which, the joystick id
  • axis, the axis index number
  • value, the value (from -32768 to 32767)

JoyBallMotion

  • which, the joystick id
  • ball, the ball number
  • xrel, the relative motion in the x direction
  • yrel, the relative motion in the y direction

JoyHatMotion

  • which, the joystick id
  • hat, the hat number
  • value, the value (see SDL.joyHat)

JoyButtonDown, JoyButtonUp

  • which, the joystick id
  • button, the button number
  • state, the state as boolean

JoyDeviceAdded, JoyDeviceRemoved

  • which, the joystick id which has been added or removed
Clone this wiki locally