Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
SDLmm::Event(3)		   Library Functions Manual	       SDLmm::Event(3)

NAME
       SDLmm::Event - The general Event	class.

SYNOPSIS
       #include	<sdlmm_event.h>

   Public Methods
       bool Poll (bool fetch=true)
	   Polls for currently pending events.
       bool Wait (bool fetch=true)
	   Waits indefinitely for the next available event.
       bool Push ()
	   Push	this event onto	the event queue.

   Static Public Methods
       Event Methods

	   void	PumpEvents ()
	       Pumps the event loop, gathering events from the input devices.
	   void	SetEventFilter (SDL_EventFilter	filter)
	       Sets up a filter	to process all events before they are posted
	       to the event queue.
	   SDL_EventFilter GetEventFilter ()
	       Retrieves a pointer to the event	filter.
	   Uint8 EventState (Uint8 type, int state)
	       Set the state of	processing for certain events.
	   void	HandleEvents (EventHandler &handler)
	       Handle all queued events	using the specified EventHandler.

       Keyboard	Methods

	   Uint8* GetKeyState (int &numkeys)
	       Get a snapshot of the current keyboard state.
	   Uint8* GetKeyState ()
	       Get a snapshot of the current keyboard state.
	   SDLMod GetModState ()
	       Get the state of	modifier keys.
	   void	SetModState (SDLMod modstate)
	       Set the current key modifier state.
	   char* GetKeyName (SDLKey key)
	       Get the name of an SDL virtual key symbol.
	   bool	EnableUNICODE (bool enable=true)
	       Enable UNICODE keyboard translation.
	   bool	DisableUNICODE ()
	       Disable UNICODE translation.
	   bool	QueryUNICODE ()
	       Query the current UNICODE translation mode.
	   bool	EnableKeyRepeat	(int delay=SDL_DEFAULT_REPEAT_DELAY, int
	       interval=SDL_DEFAULT_REPEAT_DELAY)
	       Set keyboard repeat rate.

       Mouse Methods

	   Uint8 GetMouseState (int *x=0, int *y=0)
	       Retrieve	the current state of the mouse.
	   Uint8 GetRelativeMouseState (int *x,	int *y)
	       Retrieve	the current state of the mouse.

       Other Methods

	   Uint8 GetAppState ()
	       Get the state of	the application.
	   int JoystickEventState (int state)
	       Enable /	disable	joystick event polling.

   Public Attributes
       SDL_Event me
	   The event structure.

DETAILED DESCRIPTION
       The general Event class.

       The Event class is the core to all event	handling is SDLmm. It's
       probably	the most important class after Surface.	The Event class	can be
       used to store any type of event.

MEMBER FUNCTION	DOCUMENTATION
   bool	SDLmm::Event::DisableUNICODE ()	[inline, static]
       Disable UNICODE translation.

       Returns:
	   true	if UNICODE translation was previously enabled, false
	   otherwise.

       See also:
	   EnableUNICODE, QueryUNICODE

   bool	SDLmm::Event::EnableKeyRepeat (int delay = SDL_DEFAULT_REPEAT_DELAY,
       int interval = SDL_DEFAULT_REPEAT_DELAY)	[static]
       Set keyboard repeat rate.

       Enables or disables the keyboard	repeat rate. delay specifies how long
       the key must be pressed before it begins	repeating. It then repeats at
       the speed specified by interval.	Both delay and interval	are expressed
       in milliseconds.

       Setting delay to	0 disables key repeating completely. If	called without
       parameters, the default values uses are SDL_DEFAULT_REPEAT_DELAY	and
       SDL_DEFAULT_REPEAT_INTERVAL.

       Returns:
	   true	on success, false on failure.

       Parameters:

       delay  delay before key repeating starts	in ms.

       interval
	      delay between repeats in ms.

   bool	SDLmm::Event::EnableUNICODE (bool enable = true) [inline, static]
       Enable UNICODE keyboard translation.

       If you wish to translate	a keysym to it's printable representation, you
       need to enable UNICODE translation using	this function and then look in
       the unicode member of the SDL_keysym structure. This value will be zero
       for keysyms that	do not have a printable	representation.	UNICODE
       translation is disabled by default as the conversion can	cause a	slight
       overhead.

       Parameters:

       enable if false,	disable	UNICODE	translation (SDL compatibility)

       Returns:
	   true	if UNICODE translation was previously enabled, false
	   otherwise.

       See also:
	   DisableUNICODE, QueryUNICODE

   Uint8 SDLmm::Event::EventState (Uint8 type, int state) [static]
       Set the state of	processing for certain events.

       This function allows you	to set the state of processing certain event
       types.

       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, 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 in the SDL
       documentation.

       Parameters:

       type   the event	type

       state  the state	as documented above.

       Returns:
	   the current processing state	for the	specified event	type

   Uint8 SDLmm::Event::GetAppState () [static]
       Get the state of	the application.

       This function returns the current state of the application. 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

       Returns:
	   The current state of	the application.

   SDL_EventFilter SDLmm::Event::GetEventFilter	() [static]
       Retrieves a pointer to the event	filter.

       This function retrieves a pointer to the	event filter that was
       previously set using SetEventFilter(). An SDL_EventFilter function is
       defined as:

	     typedef int (*SDL_EventFilter)(const SDL_Event *event);

       Returns:
	   Returns a pointer to	the event filter or 0 if no filter has been
	   set.

       See also:
	   SetEventFilter()

   char	* SDLmm::Event::GetKeyName (SDLKey key)	[static]
       Get the name of an SDL virtual key symbol.

       Returns:
	   the SDL defined name	of the key.

       Parameters:

       key    the SDLkey key symbol

   Uint8 * SDLmm::Event::GetKeyState ()	[static]
       Get a snapshot of the current keyboard state.

       Same as the GetKeyState(int &numkeys) method, used when you don't care
       how many	keys were returned (i.e	you want to check the state of a key
       that is known to	exist).

       Example:

	     Uint8 *keystate;
	     keystate =	Event::GetKeyState();
	     if	(keystate[SDLK_RETURN])
	       cout << 'Return Key Pressed.0;

       See also:
	   GetModState()

   Uint8 * SDLmm::Event::GetKeyState (int & numkeys) [static]
       Get a snapshot of the current keyboard state.

       Gets a snapshot of the current keyboard state. The current state	is
       returned	as a pointer to	an array. The size of this array is stored in
       numkeys.	The array is indexed by	the SDLK_* symbols. A value of 1 means
       the key is pressed and a	value of 0 means its not.

       Note:
	   Use PumpEvents() to update the state	array.

       See also:
	   PumpEvents()

       Parameters:

       numkeys
	      a	reference to an	integer	used to	store the size of the returned
	      array.

   SDLMod SDLmm::Event::GetModState () [static]
       Get the state of	modifier keys.

       Returns the current of the modifier keys	(CTRL, ALT, etc.).

       Returns:
	   The return value can	be an OR'd combination of the SDLMod enum or
	   one of the convenience defines:

       KMOD_NONE

       KMOD_LSHIFT

       KMOD_RSHIFT

       KMOD_LCTRL

       KMOD_RCTRL

       KMOD_LALT

       KMOD_RALT

       KMOD_LMETA

       KMOD_RMETA

       KMOD_NUM

       KMOD_CAPS

       KMOD_MODE

       KMOD_CTRL (KMOD_LCTRL | KMOD_RCTRL)

       KMOD_SHIFT (KMOD_LSHIFT | KMOD_RSHIFT)

       KMOD_ALT	(KMOD_LALT | KMOD_RALT)

       KMOD_META (KMOD_LMETA | KMOD_RMETA)

       See also:
	   SetModState(), GetModState()

   Uint8 SDLmm::Event::GetMouseState (int * x =	0, int * y = 0)	[static]
       Retrieve	the current state of the mouse.

       The current button state	is returned as a button	bitmask, which can be
       tested using the	SDL_BUTTON(X) macros, and x and	y are set to the
       current mouse cursor position. You can pass zero	for either x or	y.

       Returns:
	   the button bitmask.

       Parameters:

       x, y   pointers to integers where the current mouse coordinates will be
	      stored.

   Uint8 SDLmm::Event::GetRelativeMouseState (int * x, int * y)	[static]
       Retrieve	the current state of the mouse.

       The current button state	is returned as a button	bitmask, which can be
       tested using the	SDL_BUTTON(X) macros, and x and	y are set to the
       change in the mouse position since the last call	to
       SDL_GetRelativeMouseState or since event	initialization.	You can	pass
       zero for	either x or y.

       Returns:
	   the button bitmask.

       Parameters:

       x, y   pointers to integers for mouse coordinates or relative change.

   void	SDLmm::Event::HandleEvents (EventHandler & handler) [static]
       Handle all queued events	using the specified EventHandler.

       This function polls for active events and calls the event callback
       methods.	To actually handle any events, you need	to create a derivate
       of the EventHandler class reimplementing	the callbacks for the events
       you're interested in. See the EventHandler documentation	for more
       details.

       Parameters:

       handler
	      the EventHandler which should handle the events.

       See also:
	   EventHandler

   int SDLmm::Event::JoystickEventState	(int state) [static]
       Enable /	disable	joystick event polling.

   bool	SDLmm::Event::Poll (bool fetch = true)
       Polls for currently pending events.

       If there	are any	pending	events,	it will	by default be removed from the
       queue and stored	in this	class instance.

       Parameters:

       fetch  if false,	only poll for pending events but don't fetch it.

       Returns:
	   true	if any events were pending.

       See also:
	   EventHandler, HandleEvents(), Wait()

   void	SDLmm::Event::PumpEvents () [static]
       Pumps the event loop, gathering events from the input devices.

       PumpEvents() gathers all	the pending input information from devices and
       places it on the	event queue. Without calls to PumpEvents() no events
       would ever be placed on the queue. Often	the calls to PumpEvents() is
       hidden from the user since Poll and Wait	implicitly call	Pump. However,
       if you are not polling or waiting for events (e.g. your filtering
       them), then you must call Pump to force an event	queue update.

       Note:
	   You can only	call this function in the thread that set the video
	   mode.

   bool	SDLmm::Event::Push ()
       Push this event onto the	event queue.

       The event queue can actually be used as a two way communication
       channel.	Not only can events be read from the queue, but	the user can
       also push their own events onto it.

       Note:
	   Pushing device input	events onto the	queue doesn't modify the state
	   of the device within	SDL.

       Warning:
	   Make	sure to	initialize the Event before pushing it!

       Returns:
	   true	on success, falese if the Event	couldn't be pushed.

   bool	SDLmm::Event::QueryUNICODE () [inline, static]
       Query the current UNICODE translation mode.

       This function checks whether UNICODE translation	is enabled or
       disabled.

       Returns:
	   true	if UNICODE translation is enabled, false otherwise.

       See also:
	   EnableUNICODE, DisableUNICODE

   void	SDLmm::Event::SetEventFilter (SDL_EventFilter filter) [static]
       Sets up a filter	to process all events before they are posted to	the
       event queue.

       This function sets up a filter to process all events before they	are
       posted to the event queue. This is a very powerful and flexible
       feature.	The filter is prototyped as:

	     typedef int (*SDL_EventFilter)(const SDL_Event *event);

       If the filter returns 1,	then the event will be added to	the internal
       queue. If it returns 0, then the	event will be dropped from the queue.
       This allows selective filtering of dynamically.

       There is	one caveat when	dealing	with the SDL_QUITEVENT event type. The
       event filter is only called when	the window manager desires to close
       the application window. If the event filter returns 1, then the window
       will be closed, otherwise the window will remain	open if	possible. If
       the quit	event is generated by an interrupt signal, it will bypass the
       internal	queue and be delivered to the application at the next event
       poll.

       Note:
	   Events pushed onto the queue	with Push() or Peep() do not get
	   passed through the event filter.

       Warning:
	   Be careful! The event filter	function may run in a different	thread
	   so be careful what you do within it.

       See also:
	   GetEventFilter()

   void	SDLmm::Event::SetModState (SDLMod modstate) [static]
       Set the current key modifier state.

       The inverse of GetModState(), SetModState() allows you to impose
       modifier	key states on your application.

       Simply pass your	desired	modifier states	into modstate. This value my
       be a logical OR'd combination of	the symbols documented in
       GetModState().

       Parameters:

       modstate
	      the new key modifier state.

       See also:
	   GetModState()

   bool	SDLmm::Event::Wait (bool fetch = true)
       Waits indefinitely for the next available event.

       This function will wait for an event to become available. It will not
       return until an event is	queued.

       Parameters:

       fetch  if false,	don't fetch and	dequeue	the event once it becomes
	      available.

       Returns:
	   true	when an	event became available and false if something went
	   wrong.

       See also:
	   EventHandler, HandleEvents(), Poll()

MEMBER DATA DOCUMENTATION
   SDL_Event SDLmm::Event::me
       The event structure.

       If you use the event polling method, this is where the result is
       stored. You should consider using the more elegant EventHandler method
       instead however.

       See also:
	   EventHandler, HandleEvents(), Poll(), Wait()

AUTHOR
       Generated automatically by Doxygen for SDLmm from the source code.

SDLmm				  16 Jul 2001		       SDLmm::Event(3)

NAME | SYNOPSIS | DETAILED DESCRIPTION | MEMBER FUNCTION DOCUMENTATION | MEMBER DATA DOCUMENTATION | AUTHOR

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=SDLmm_Event&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help