|
|||||||||
| Home >> All >> org >> libsdl >> [ event overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.libsdl.event
Class SDLEventManager

java.lang.Objectorg.libsdl.event.SDLEventManager
- public class SDLEventManager
- extends java.lang.Object
The SDLEventManager class encompasses the ability to
receive events, either by polling or waiting. Most of the event related
SDL functions can be found here, such as SDL_WaitEvent, SDL_PumpEvents,
and SDL_PollEvent (to name a few).
------ EXAMPLE ------
SDL sdl = SDL.getInstance();
sdl.init(SDL.SDL_INIT_EVERYTHING);
SDLEventManager eventManager = sdl.getEventManager();
SDLEvent event = null;
while ( (event = eventManager.waitEvent()) != null ) {
if (event instanceOf SDLMouseButtonEvent) {
// do something
} else if (event instanceOf SDLKeyboardEvent) {
// do something else
} // etc...
}
- Version:
- $revision$
| Field Summary | |
static short |
SDL_APPACTIVE
|
static short |
SDL_APPINPUTFOCUS
|
static short |
SDL_APPMOUSEFOCUS
|
static int |
SDL_DISABLE
|
static int |
SDL_ENABLE
|
static int |
SDL_IGNORE
|
static int |
SDL_QUERY
|
| Constructor Summary | |
SDLEventManager()
|
|
| Method Summary | |
boolean |
appHasInputFocus()
Convenience method to break down the output of getAppState(). |
boolean |
appHasMouseFocus()
Convenience method to break down the output of getAppState(). |
boolean |
appIsActive()
Convenience method to break down the output of getAppState(). |
boolean |
enableKeyRepeat(int delay,
int interval)
This method needs to be called to enable key repeat. |
boolean |
enableUNICODE(boolean enable)
This method needs to be called to enable UNICODE translation. |
short |
eventState(short type,
int state)
Set the event state. |
short |
getAppState()
Gets the current app state. |
SDLCursor |
getCursor()
Get the current cursor. |
java.lang.String |
getKeyName(int key)
Get the name of an SDL virtual keysym. |
SDLMod |
getModState()
Returns the state of the modifier keys. |
SDLMouseState |
getMouseState()
Gets the current mouse state. |
SDLMouseState |
getRelativeMouseState()
Gets the current relative mouse state (relative to the last time the method was called). |
int |
joystickEventState(int state)
Enable/disable joystick event polling. |
SDLEvent |
pollEvent()
Polls the event queue. |
void |
pumpEvents()
Pumps the event queue. |
boolean |
pushEvent(SDLEvent event)
Push an event onto the event queue. |
void |
setCursor(SDLCursor cursor)
Change the current cursor. |
void |
setModState(SDLMod modstate)
Sets the state of the modifier keys. |
int |
showCursor(int toggle)
Toggle whether or not to show the cursor. |
SDLEvent |
waitEvent()
Blocks until an event is ready to be returned. |
void |
warpMouse(int x,
int y)
Move the mouse pointer to a specific location. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
SDL_APPMOUSEFOCUS
public static short SDL_APPMOUSEFOCUS
SDL_APPINPUTFOCUS
public static short SDL_APPINPUTFOCUS
SDL_APPACTIVE
public static short SDL_APPACTIVE
SDL_QUERY
public static int SDL_QUERY
SDL_IGNORE
public static int SDL_IGNORE
SDL_DISABLE
public static int SDL_DISABLE
SDL_ENABLE
public static int SDL_ENABLE
| Constructor Detail |
SDLEventManager
public SDLEventManager()
| Method Detail |
pumpEvents
public void pumpEvents()
- Pumps the event queue. This method is typically used when filtering
events, as it is implicitly called by
pollEvent()andwaitEvent().Corresponds:
SDL_PumpEvents()
pollEvent
public SDLEvent pollEvent()
- Polls the event queue. If an event is ready to be returned, it will be.
If no event is ready, this method will return null.
Corresponds:
SDL_PollEvent()
waitEvent
public SDLEvent waitEvent()
- Blocks until an event is ready to be returned.
Corresponds:
SDL_WaitEvent()
pushEvent
public boolean pushEvent(SDLEvent event)
- Push an event onto the event queue.
Corresponds:
SDL_PushEvent()
eventState
public short eventState(short type,
int state)
- Set the event state. This method sets how certain kinds of
events are handled.
Corresponds:
SDL_EventState()
getModState
public SDLMod getModState()
- Returns the state of the modifier keys.
Corresponds:
SDL_GetModState()
setModState
public void setModState(SDLMod modstate)
- Sets the state of the modifier keys.
Corresponds:
SDL_SetModState()
getKeyName
public java.lang.String getKeyName(int key)
- Get the name of an SDL virtual keysym.
Corresponds:
SDL_GetKeyName()
enableUNICODE
public boolean enableUNICODE(boolean enable)
- This method needs to be called to enable UNICODE translation.
Corresponds:
SDL_EnableUNICODE()
enableKeyRepeat
public boolean enableKeyRepeat(int delay,
int interval)
- This method needs to be called to enable key repeat.
Corresponds:
SDL_EnableKeyRepeat()
getMouseState
public SDLMouseState getMouseState()
- Gets the current mouse state.
Corresponds:
SDL_GetMouseState()
getRelativeMouseState
public SDLMouseState getRelativeMouseState()
- Gets the current relative mouse state (relative to the last time
the method was called).
Corresponds:
SDL_GetRelativeMouseState()
getAppState
public short getAppState()
- Gets the current app state. This method will return various pieces of
information.
Corresponds:
SDL_GetAppState()
joystickEventState
public int joystickEventState(int state)
- Enable/disable joystick event polling.
Corresponds:
SDL_JoystickEventState()
warpMouse
public void warpMouse(int x,
int y)
- Move the mouse pointer to a specific location.
Corresponds:
SDL_WarpMouse()
setCursor
public void setCursor(SDLCursor cursor)
- Change the current cursor.
Corresponds:
SDL_SetCursor()
getCursor
public SDLCursor getCursor()
- Get the current cursor.
Corresponds:
SDL_GetCursor()
showCursor
public int showCursor(int toggle)
- Toggle whether or not to show the cursor.
Corresponds:
SDL_ShowCursor()
appHasMouseFocus
public boolean appHasMouseFocus()
- Convenience method to break down the output of
getAppState().
appHasInputFocus
public boolean appHasInputFocus()
- Convenience method to break down the output of
getAppState().
appIsActive
public boolean appIsActive()
- Convenience method to break down the output of
getAppState().
|
|||||||||
| Home >> All >> org >> libsdl >> [ event overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.libsdl.event.SDLEventManager