ManaPlus
eventsmanager.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2012-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef EVENTSMANAGER_H
23 #define EVENTSMANAGER_H
24 
26 
27 PRAGMA48(GCC diagnostic push)
28 PRAGMA48(GCC diagnostic ignored "-Wshadow")
29 #include <SDL_events.h>
30 PRAGMA48(GCC diagnostic pop)
31 
32 #include "localconsts.h"
33 
35 {
36  public:
37  EventsManager();
38 
40 
41  ~EventsManager() override final;
42 
43  void init();
44 
45  void enableEvents();
46 
47  void shutdown();
48 
49  bool handleEvents() const;
50 
51  bool handleCommonEvents(const SDL_Event &event) const;
52 
53  void handleGameEvents() const;
54 
55 #ifdef USE_SDL2
56  static void handleSDL2WindowEvent(const SDL_Event &event);
57 #else // USE_SDL2
58 
59  static void handleActive(const SDL_Event &event);
60 #endif // USE_SDL2
61 
62  void optionChanged(const std::string &name) override final;
63 
64  static void logEvent(const SDL_Event &event);
65 
66  protected:
67  bool mLogInput;
68 };
69 
71 
72 #endif // EVENTSMANAGER_H
void optionChanged(const std::string &name)
bool handleEvents() const
void handleGameEvents() const
bool handleCommonEvents(const SDL_Event &event) const
static void logEvent(const SDL_Event &event)
static void handleActive(const SDL_Event &event)
EventsManager eventsManager
#define final
Definition: localconsts.h:46
#define PRAGMA48(str)
Definition: localconsts.h:199
#define A_DELETE_COPY(func)
Definition: localconsts.h:53