gramods
SdlContext.hh
1 
2 #ifndef GRAMODS_CORE_SDLCONTEXT
3 #define GRAMODS_CORE_SDLCONTEXT
4 
5 #include <gmCore/config.hh>
6 
7 #ifdef gramods_ENABLE_SDL2
8 
9 #include <SDL.h>
10 
11 #include <gmCore/Object.hh>
12 #include <gmCore/OFactory.hh>
13 
14 BEGIN_NAMESPACE_GMCORE;
15 
21  : public gmCore::Object {
22 
23 public:
24 
25  SdlContext();
26  ~SdlContext();
27 
34  void setUseVideo(bool on) { use_video = on; }
35 
42  void setUseAudio(bool on) { use_audio = on; }
43 
44  GM_OFI_DECLARE;
45 
49  static bool hasVideo();
50 
54  static bool hasAudio();
55 
56  void initialize() override;
57 
62  virtual std::string getDefaultKey() override { return "context"; }
63 
64 private:
65 
66  static bool has_video;
67  static bool has_audio;
68  static bool has_instance;
69 
70  bool use_video = false;
71  bool use_audio = false;
72 
73 };
74 
75 
76 END_NAMESPACE_GMCORE;
77 
78 #endif
79 #endif
Base type for objects in the Gramods package for standardized handling of construction,...
Definition: Object.hh:42
The SdlContext class initializes SDL with the specified parameters.
Definition: SdlContext.hh:21
void setUseAudio(bool on)
Enable or disable initialization of SDL audio engine.
Definition: SdlContext.hh:42
void setUseVideo(bool on)
Enable or disable initialization of SDL video engine.
Definition: SdlContext.hh:34
virtual std::string getDefaultKey() override
Returns the default key, in Configuration, for the Object.
Definition: SdlContext.hh:62