Tinman  1.0
gui.h
Go to the documentation of this file.
1 // Copyright (C) 2014 ISAAC LACOBA MOLINA
2 // Tinman author: Isaac Lacoba Molina
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU 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 // This program 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 General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef GUI_H
18 #define GUI_H
19 #include <memory>
20 
21 #include <OgreOverlayContainer.h>
22 #include <OgreOverlayManager.h>
23 #include <OgreOverlayElement.h>
24 #include <OgreTextAreaOverlayElement.h>
25 #include <OgreFontManager.h>
26 
27 #include <CEGUI/CEGUI.h>
28 #include <CEGUI/RendererModules/Ogre/Renderer.h>
29 
30 class GUI {
31  Ogre::OverlayManager* overlay_manager_;
32 
33  const std::string default_font_ = "Manila-12";
34 
35 public:
36  typedef std::shared_ptr<GUI> shared;
37 
38  GUI();
39  virtual ~GUI();
40  void switch_menu();
41  void register_callback(std::string button, CEGUI::Event::Subscriber callback);
42 
43  CEGUI::Window* load_layout(std::string file);
44  CEGUI::AnimationInstance* load_animation(std::string name, CEGUI::Window* window);
45  Ogre::OverlayElement* create_overlay(std::string name, std::string element);
46  Ogre::OverlayElement* create_overlay(std::string name, std::string element,
47  std::pair<float, float> position,
48  std::pair<float, float> dimension);
49  CEGUI::GUIContext& get_context();
50  void inject_delta(float delta);
51 
52 private:
53  void load_resources();
54  void init();
55 };
56 
57 
58 #endif
virtual ~GUI()
Definition: gui.cpp:27
CEGUI::Window * load_layout(std::string file)
Definition: gui.cpp:53
Ogre::OverlayElement * create_overlay(std::string name, std::string element)
Definition: gui.cpp:69
const std::string default_font_
Definition: gui.h:33
CEGUI::AnimationInstance * load_animation(std::string name, CEGUI::Window *window)
Definition: gui.cpp:58
CEGUI::GUIContext & get_context()
Definition: gui.cpp:109
void register_callback(std::string button, CEGUI::Event::Subscriber callback)
void init()
Definition: gui.cpp:42
Definition: gui.h:30
void inject_delta(float delta)
Definition: gui.cpp:114
Ogre::OverlayManager * overlay_manager_
Definition: gui.h:31
void load_resources()
Definition: gui.cpp:33
std::shared_ptr< GUI > shared
Definition: gui.h:36
void switch_menu()
GUI()
Definition: gui.cpp:20