Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

sdlmm_event.h

Go to the documentation of this file.
00001 /*
00002  * SDLmm - a C++ wrapper for SDL and related libraries
00003  * Copyright  2001 David Hedbor <david@hedbor.org>
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License as
00007  * published by the Free Software Foundation; either version 2 of the
00008  * License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *
00019  */
00020 
00021 #ifndef SDLMM_EVENT_H
00022 #define SDLMM_EVENT_H
00023 #include <cstring>
00024 
00025 namespace SDLmm {
00027 
00032   class DECLSPEC Event {
00033   public:
00035 
00041     SDL_Event me;
00042 
00044 
00052     bool Poll(bool fetch = true);
00053     
00055 
00064     bool Wait(bool fetch = true);
00065 
00067 
00077     bool Push();
00078 
00080 
00081 
00082 
00094     static void PumpEvents();
00095 
00098 
00126     static void SetEventFilter(SDL_EventFilter filter);
00127 
00129 
00141     static SDL_EventFilter  GetEventFilter();
00142 
00144 
00166     static Uint8 EventState(Uint8 type, int state);
00167 
00169 
00178     static void HandleEvents(EventHandler &handler);
00179     
00181 
00191     static void HandleEvent(EventHandler &handler, const SDL_Event& event);
00192     
00194 
00196 
00197     
00199 
00211     static Uint8 *GetKeyState(int &numkeys);
00212 
00214 
00227     static Uint8 *GetKeyState();
00228 
00230 
00252     static SDLMod GetModState();
00253 
00255 
00265     static void SetModState(SDLMod modstate);
00266 
00268 
00272     static char *GetKeyName(SDLKey key);
00273 
00275 
00290     static bool EnableUNICODE(bool enable=true) { return SDL_EnableUNICODE(enable) != 0; }
00291 
00293 
00298     static bool DisableUNICODE() { return SDL_EnableUNICODE(0) != 0; }
00299 
00301 
00307     static bool QueryUNICODE() { return SDL_EnableUNICODE(-1) != 0; }
00308 
00310 
00325     static bool EnableKeyRepeat(int delay = SDL_DEFAULT_REPEAT_DELAY,
00326                                 int interval = SDL_DEFAULT_REPEAT_DELAY);
00328 
00330 
00331 
00332 
00342     static Uint8 GetMouseState(int *x = 0, int *y = 0);
00343 
00345 
00356     static Uint8 GetRelativeMouseState(int *x, int *y);    
00358 
00360 
00361 
00363 
00376     static Uint8 GetAppState();
00377 
00379     /*
00380       This function is used to enable or disable joystick event
00381       processing. With joystick event processing disabled you will
00382       have to update joystick states with Joystick::JoystickUpdate()
00383       and read the joystick information manually. \a state is either
00384       SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
00385 
00386       \note Joystick event handling is preferred.
00387       \return If \a state is SDL_QUERY then the current state is
00388       returned, otherwise the new processing \a state is returned.
00389       \param state the state as documented above.
00390     */
00391     
00392     static int JoystickEventState(int state);
00393     
00395   };
00396 }
00397 
00398 #endif // SDLMM_EVENT_H
00399 

Documentation automatically generated by doxygen written by Dimitri van Heesch. Project hosted at
Hosted by SourceForge