FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
librocketmanager.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2013 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_GUI_LIBROCKETMANAGER_H
23 #define FIFE_GUI_LIBROCKETMANAGER_H
24 
25 // Standard C++ library includes
26 #include <map>
27 #include <string>
28 
29 // 3rd party library includes
30 #include <Rocket/Core/SystemInterface.h>
31 
32 // FIFE includes
33 // These includes are split up in two parts, separated by one empty line
34 // First block: files included from the FIFE root src directory
35 // Second block: files included from the same folder
36 #include "util/base/singleton.h"
37 #include "gui/guimanager.h"
38 
39 namespace Rocket {
40 
41  namespace Core {
42  class Context;
43  class ElementDocument;
44  }
45 };
46 
47 namespace FIFE {
48 
49  class LibRocketInputProcessor;
50  class LibRocketRenderInterface;
51 
53  public Rocket::Core::SystemInterface,
54  public IGUIManager,
55  public DynamicSingleton<LibRocketManager> {
56 
57  public:
58 
62 
66  virtual ~LibRocketManager();
67 
71  void init(const std::string& backend, int32_t screenWidth, int32_t screenHeight);
72 
80  virtual float GetElapsedTime();
81 
84  virtual void turn();
85 
93  virtual void resizeTopContainer(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
94 
101  virtual Rocket::Core::ElementDocument* loadDocument(const std::string& id, const std::string& documentPath);
102 
105  virtual Rocket::Core::ElementDocument* getDocument(const std::string& id);
106 
109  virtual void unloadDocument(Rocket::Core::ElementDocument* document);
110 
113  virtual void unloadDocument(const std::string& id);
114 
120  virtual void loadFont(const std::string& filepath);
121 
125  virtual bool onSdlEvent(SDL_Event& evt);
126 
129  void showDebugger() const;
130 
134  void hideDebugger() const;
135 
136  private:
137 
141  void unloadDocuments();
142 
145  Rocket::Core::Context* m_context;
146 
150 
154 
157  std::map<std::string, Rocket::Core::ElementDocument*> m_openDocuments;
158 
159  };
160 };
161 
162 #endif //FIFE_GUI_LIBROCKETMANAGER_H
virtual void turn()
Updates and renders the gui.
virtual Rocket::Core::ElementDocument * loadDocument(const std::string &id, const std::string &documentPath)
Loads a rocket .rml file and shows it.
virtual void unloadDocument(Rocket::Core::ElementDocument *document)
Unloads a rocket document.
virtual float GetElapsedTime()
There is an inconsistency in the naming of this method, it's in upper camelcase and should have been ...
void init(const std::string &backend, int32_t screenWidth, int32_t screenHeight)
Initializes the librocket manager.
LibRocketInputProcessor * m_inputProcessor
Input processor for librocket.
std::map< std::string, Rocket::Core::ElementDocument * > m_openDocuments
A set of all open documents.
void hideDebugger() const
Hides the librocket debugger.
LibRocketRenderInterface * m_renderInterface
Render Interface for librocket.
virtual void loadFont(const std::string &filepath)
Loads a font to be used by librocket.
void showDebugger() const
Shows the librocket debugger.
LibRocketManager()
Constructor.
virtual void resizeTopContainer(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
Resizes the top container.
Another Singleton.
Definition: singleton.h:82
virtual bool onSdlEvent(SDL_Event &evt)
Receives input and converts it to librocket format, then it forwards it to librocket.
void unloadDocuments()
Unloads documents opened by librocket.
virtual Rocket::Core::ElementDocument * getDocument(const std::string &id)
Rocket::Core::Context * m_context
Librocket's context.
unsigned int uint32_t
Definition: core.h:40
virtual ~LibRocketManager()
Destructor.