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 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
    00183
    00184
    00186
    00198     static Uint8 *GetKeyState(int &numkeys);
    00199
    00201
    00214     static Uint8 *GetKeyState();
    00215
    00217
    00239     static SDLMod GetModState();
    00240
    00242
    00252     static void SetModState(SDLMod modstate);
    00253
    00255
    00259     static char *GetKeyName(SDLKey key);
    00260
    00262
    00277     static bool EnableUNICODE(bool enable=true) { return SDL_EnableUNICODE(enable) != 0; }
    00278
    00280
    00285     static bool DisableUNICODE() { return SDL_EnableUNICODE(0) != 0; }
    00286
    00288
    00294     static bool QueryUNICODE() { return SDL_EnableUNICODE(-1) != 0; }
    00295
    00297
    00312     static bool EnableKeyRepeat(int delay = SDL_DEFAULT_REPEAT_DELAY,
    00313                                 int interval = SDL_DEFAULT_REPEAT_DELAY);
    00315
    00317
    00318
    00319
    00329     static Uint8 GetMouseState(int *x = 0, int *y = 0);
    00330
    00332
    00343     static Uint8 GetRelativeMouseState(int *x, int *y);
    00345
    00347
    00348
    00350
    00363     static Uint8 GetAppState();
    00364
    00366     /*
    00367       This function is used to enable or disable joystick event
    00368       processing. With joystick event processing disabled you will
    00369       have to update joystick states with Joystick::JoystickUpdate()
    00370       and read the joystick information manually. \a state is either
    00371       SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
    00372
    00373       \note Joystick event handling is preferred.
    00374       \return If \a state is SDL_QUERY then the current state is
    00375       returned, otherwise the new processing \a state is returned.
    00376       \param state the state as documented above.
    00377     */
    00378
    00379     static int JoystickEventState(int state);
    00380
    00382   };
    00383 }
    00384
    00385 #endif // SDLMM_EVENT_H
    00386

Documentation automatically generated by written by Dimitri van Heesch. | Project hosted at