18 #ifndef _GUI_OVERLAY_HH_
19 #define _GUI_OVERLAY_HH_
48 class GUIOverlayPrivate;
66 public:
void Init(Ogre::RenderTarget *_renderTarget);
90 const std::string &_name,
91 const std::string &_parent,
94 const std::string &_text);
113 public:
void LoadLayout(
const std::string &_filename);
122 const std::string &_windowName);
132 const std::string &_windowName);
135 public:
void Resize(
unsigned int _width,
unsigned int _height);
138 private:
void PreRender();
143 private:
int GetKeyCode(
const std::string &_unicode);
146 public: CEGUI::Window *GetWindow(
const std::string &_name);
154 private: CEGUI::Window *LoadLayoutImpl(
const std::string &_filename);
159 private:
bool OnButtonClicked(
const CEGUI::EventArgs &_e);
168 public:
template<
typename T>
170 void (T::*_fp)(), T *_obj)
173 CEGUI::Window *buttonWindow;
175 CEGUI::WindowManager::getSingletonPtr()->getWindow(
177 buttonWindow->subscribeEvent(CEGUI::PushButton::EventClicked,
178 CEGUI::Event::Subscriber(&GUIOverlay::OnButtonClicked,
this));
180 this->
callbacks[_buttonName] = boost::bind(_fp, _obj);
182 if (_buttonName && _fp && _obj)
184 gzerr <<
"CEGUI not installed." << std::endl;
190 public: std::map<std::string, boost::function<void()> >
callbacks;
bool HandleKeyPressEvent(const std::string &_key)
Handle a key press event.
boost::shared_ptr< DepthCamera > DepthCameraPtr
Definition: RenderTypes.hh:88
void Resize(unsigned int _width, unsigned int _height)
Resize the window.
Generic description of a mouse event.
Definition: MouseEvent.hh:32
void Show()
Make the overlay visible.
bool HandleKeyReleaseEvent(const std::string &_key)
Handle a key release event.
Generic double x, y vector.
Definition: Vector2d.hh:39
void Init(Ogre::RenderTarget *_renderTarget)
Initialize the overlay.
bool HandleMouseEvent(const common::MouseEvent &_evt)
Handle a mouse event.
void Update()
Update the overlay's objects.
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:80
#define gzerr
Output an error message.
Definition: Console.hh:47
virtual ~GUIOverlay()
Destructor.
Private data for the GUIOverlay class.
Definition: GUIOverlayPrivate.hh:45
void ButtonCallback(const std::string &_buttonName, void(T::*_fp)(), T *_obj)
Register a CEGUI button callback.
Definition: GUIOverlay.hh:169
bool AttachCameraToImage(CameraPtr &_camera, const std::string &_windowName)
Use this function to draw the output from a rendering::Camera to and overlay window.
bool IsInitialized()
Return true if the overlay has been initialized.
A class that creates a CEGUI overlay on a render window.
Definition: GUIOverlay.hh:55
std::map< std::string, boost::function< void()> > callbacks
Map of callback functions to names.
Definition: GUIOverlay.hh:190
void CreateWindow(const std::string &_type, const std::string &_name, const std::string &_parent, const math::Vector2d &_position, const math::Vector2d &_size, const std::string &_text)
Create a new window on the overlay.
void LoadLayout(const std::string &_filename)
Load a CEGUI layout file.
void Hide()
Make the overlay invisible.