|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sdljava.event.SDLEvent
public abstract class SDLEvent
The SDL_Event is the core to all event handling in SDL, its probably the most important structure after SDL_Surface. SDL_Event is a union of all event structures used in SDL, using it is a simple matter of knowing which union member relates to which event type.
In the case of sdljava you can simply deal with the returned SDLEvent instance. For example if you have the code SDLEvent event = SDLEvent.waitEvent() you can now do an instanceof on the returned event to determine its type, cast it to the appropriate class, then deal with the data in any way you wish. NOTE: The following is not yet implemented:
Constructor Summary | |
---|---|
SDLEvent()
|
Method Summary | |
---|---|
static void |
enableKeyRepeat(int delay,
int interval)
Enables or disables the keyboard repeat rate. |
static int |
enableUNICODE(int mode)
Enables/Disables Unicode keyboard translation. |
static SDLEventState |
eventState(int type,
SDLEventState state)
This function allows you to set the state of processing certain event types. |
static SDLAppState |
getAppState()
This function returns the current state of the application. |
static java.lang.String |
getKeyName(int key)
Get the name of an SDL virtual keysym |
static SDLMod |
getModState()
Get the state of modifier keys. |
static MouseState |
getMouseState()
Retrieve the current state of the mouse |
static MouseState |
getRelativeMouseState()
Retrieve the relative current state of the mouse since the last call to getRelativeMouseState() |
abstract int |
getType()
The type of the this event |
static int |
joystickEventState(SDLEventState state)
This function is used to enable or disable joystick event processing. |
static SDLEvent |
pollEvent()
Polls for currently pending events. |
static SDLEvent |
pollEvent(boolean returnEvent)
Polls for currently pending events. |
(package private) static SDLEvent |
processEvent(SDL_Event swigEvent)
|
static void |
pumpEvents()
Pumps the event loop, gathering events from the input devices. |
static void |
setModState(SDLMod mod)
Describe setModState method here. |
static SDLEvent |
waitEvent()
Waits indefinitely for the next available event |
static SDLEvent |
waitEvent(boolean returnEvent)
Waits indefinitely for the next available event |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SDL_ADDEVENT
public static final int SDL_PEEKEVENT
public static final int SDL_GETEVENT
public static final int SDL_QUERY
public static final int SDL_IGNORE
public static final int SDL_DISABLE
public static final int SDL_ENABLE
public static final int SDL_DEFAULT_REPEAT_DELAY
public static final int SDL_DEFAULT_REPEAT_INTERVAL
public static final int SDL_PRESSED
public static final int SDL_RELEASED
public static final int SDL_NOEVENT
public static final int SDL_ACTIVEEVENT
public static final int SDL_KEYDOWN
public static final int SDL_KEYUP
public static final int SDL_MOUSEMOTION
public static final int SDL_MOUSEBUTTONDOWN
public static final int SDL_MOUSEBUTTONUP
public static final int SDL_JOYAXISMOTION
public static final int SDL_JOYBALLMOTION
public static final int SDL_JOYHATMOTION
public static final int SDL_JOYBUTTONDOWN
public static final int SDL_JOYBUTTONUP
public static final int SDL_QUIT
public static final int SDL_SYSWMEVENT
public static final int SDL_VIDEORESIZE
public static final int SDL_VIDEOEXPOSE
public static final int SDL_USEREVENT
public static final int SDL_ACTIVEEVENTMASK
public static final int SDL_KEYDOWNMASK
public static final int SDL_KEYUPMASK
public static final int SDL_MOUSEMOTIONMASK
public static final int SDL_MOUSEBUTTONDOWNMASK
public static final int SDL_MOUSEBUTTONUPMASK
public static final int SDL_MOUSEEVENTMASK
public static final int SDL_JOYAXISMOTIONMASK
public static final int SDL_JOYBALLMOTIONMASK
public static final int SDL_JOYHATMOTIONMASK
public static final int SDL_JOYBUTTONDOWNMASK
public static final int SDL_JOYBUTTONUPMASK
public static final int SDL_JOYEVENTMASK
public static final int SDL_VIDEORESIZEMASK
public static final int SDL_VIDEOEXPOSEMASK
public static final int SDL_QUITMASK
public static final int SDL_SYSWMEVENTMASK
public static final int SDL_APPMOUSEFOCUS
public static final int SDL_APPINPUTFOCUS
public static final int SDL_APPACTIVE
public static final int SDL_BUTTON_LEFT
public static final int SDL_BUTTON_MIDDLE
public static final int SDL_BUTTON_RIGHT
public static final int SDL_BUTTON_WHEELUP
public static final int SDL_BUTTON_WHEELDOWN
static SDL_Event swigEvent
static SDLActiveEvent activeEvent
static SDLKeyboardEvent sdlKeyboardEvent
static SDLMouseMotionEvent mouseMotionEvent
static SDLMouseButtonEvent mouseButtonEvent
static SDLJoyAxisEvent joyAxisEvent
static SDLJoyBallEvent joyBallEvent
static SDLJoyHatEvent joyHatEvent
static SDLJoyButtonEvent joyButtonEvent
static SDLResizeEvent resizeEvent
static SDLExposeEvent exposeEvent
static SDLQuitEvent quitEvent
static SDLUserEvent userEvent
static SDLSysWMEvent sysWMEvent
static DummyEvent dummyEvent
Constructor Detail |
---|
public SDLEvent()
Method Detail |
---|
public static void pumpEvents() throws SDLException
SDL_PumpEvents gathers all the pending input information from devices and places it on the event queue. Without calls to SDL_PumpEvents no events would ever be placed on the queue. Often the need for calls to SDL_PumpEvents is hidden from the user since SDL_PollEvent and SDL_WaitEvent implicitly call SDL_PumpEvents. However, if you are not polling or waiting for events (e.g. you are filtering them), then you must call SDL_PumpEvents to force an event queue update.
Note: You can only call this function in the thread that set the video mode.
SDLException
- if an error occurspublic static SDLEvent pollEvent(boolean returnEvent) throws SDLException
If returnEvent is true the next event is removed from the queue and returned (if one exists)
returnEvent
- specifies if the event should be returned
If returnEvent is false: non-null SDLEvent instance if an event is available, otherwise null
SDLException
- if an error occurspublic static SDLEvent pollEvent() throws SDLException
SDLException
- if an error occurspublic static SDLEvent waitEvent(boolean returnEvent) throws SDLException
If returnEvent is true the next event is removed from the queue and returned (if one exists)
Otherwise the method simply returns once the next event is available
returnEvent
- specifies if the event should be returned
SDLException
- if an error occurspublic static SDLEvent waitEvent() throws SDLException
SDLException
- if an error occurspublic static SDLEventState eventState(int type, SDLEventState state) throws SDLException
If state is set to SDL_IGNORE, that event type will be automatically dropped from the event queue and will not be filtered.
If state is set to SDL_ENABLE, that event type will be processed normally.
If state is set to SDL_QUERY, SDL_EventState will return the current processing state of the specified event type.
A list of event types can be found in the SDL_Event section.
type
- a SDLEventType
valuestate
- a SDLEventState
value
SDLEventState
value
SDLException
- if an error occurspublic static SDLMod getModState()
public static void setModState(SDLMod mod)
setModState
method here.
public static java.lang.String getKeyName(int key)
key
- a SDLKey
value
public static int enableUNICODE(int mode) throws SDLException
To obtain the character codes corresponding to received keyboard events, Unicode translation must first be turned on using this function. The translation incurs a slight overhead for each keyboard event and is therefore disabled by default. For each subsequently received key down event, the unicode member of the SDL_keysym structure will then contain the corresponding character code, or zero for keysyms that do not correspond to any character code.
A value of 1 for enable enables Unicode translation; 0 disables it, and -1 leaves it unchanged (useful for querying the current translation mode).
Note that only key press events will be translated, not release events.
enable
- a boolean
value
SDLException
- if an error occurspublic static void enableKeyRepeat(int delay, int interval) throws SDLException
Setting delay to 0 disables key repeating completely. Good default values are SDL_DEFAULT_REPEAT_DELAY and SDL_DEFAULT_REPEAT_INTERVAL
delay
- an int
valueinterval
- an int
value
SDLException
- if an error occurspublic static MouseState getMouseState() throws SDLException
SDLMouseState
value
SDLException
- if an error occurspublic static MouseState getRelativeMouseState() throws SDLException
MouseState
value
SDLException
- if an error occurspublic static SDLAppState getAppState() throws SDLException
The value returned is a bitwise combination of:
SDL_APPMOUSEFOCUS The application has mouse focus.
SDL_APPINPUTFOCUS The application has keyboard focus
SDL_APPACTIVE The application is visible
int
value
SDLException
- if an error occurspublic static int joystickEventState(SDLEventState state) throws SDLException
Note: Joystick event handling is preferred
state
- a SDLEventState
value
SDLException
- if an error occurspublic abstract int getType()
static final SDLEvent processEvent(SDL_Event swigEvent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |