zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Core.h
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * zenilib is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
35 #ifndef ZENI_CORE_H
36 #define ZENI_CORE_H
37 
38 #include <Zeni/Error.h>
39 #include <Zeni/Singleton.h>
40 
41 #ifdef ANDROID
43 #endif
44 
45 namespace Zeni {
46 
47  class ZENI_CORE_DLL Core;
48 
49 #ifdef _WINDOWS
50  ZENI_CORE_EXT template class ZENI_CORE_DLL Singleton<Core>;
51 #endif
52 
53  class ZENI_CORE_DLL Core : public Singleton<Core> {
54  friend class Singleton<Core>;
55 
56  static Core * create();
57 
58  Core();
59  ~Core();
60 
61  // Undefined
62  Core(const Core &);
63  Core & operator=(const Core &);
64 
65  public:
66 #ifdef ANDROID
67  static void preinit(android_app * const &state);
68 
69  android_app & get_state();
70 #endif
71 
72  bool is_screen_saver_enabled();
73  void set_screen_saver(const bool &enabled);
74 
75  static void assert_no_error();
76  static bool print_error();
77 
78 #ifdef ANDROID
79  private:
80  static android_app *g_state;
81  bool m_screen_saver_enabled;
82 #endif
83  };
84 
85  // Get reference to only instance; Might throw Core_Init_Failure
86  ZENI_CORE_DLL Core & get_Core();
87 
88  struct ZENI_CORE_DLL Core_Init_Failure : public Error {
89  Core_Init_Failure() : Error("Zeni Core Failed to Initialize Correctly") {}
90  };
91 
92 }
93 
94 #endif
GLenum GLsizei const GLuint GLboolean enabled
Definition: glew.h:2538
The Core Singleton.
Definition: Core.h:53
Core & get_Core()
Get access to the singleton.
Definition: Core.cpp:71
The Error Class.
Definition: Error.h:52