2009-01-29 00:18:34 +08:00
|
|
|
|
|
|
|
#ifndef WXSFMLCANVAS_HPP
|
|
|
|
#define WXSFMLCANVAS_HPP
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// Headers
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
#include <wx/wx.h>
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// wxSFMLCanvas allows to run SFML in a wxWidgets control
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
class wxSFMLCanvas : public wxControl, public sf::RenderWindow
|
|
|
|
{
|
|
|
|
public :
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// Construct the wxSFMLCanvas
|
|
|
|
///
|
2009-10-15 16:37:32 +08:00
|
|
|
/// \param parent : Parent of the control
|
|
|
|
/// \param id : Identifier of the control
|
|
|
|
/// \param position : Position of the control
|
|
|
|
/// \param size : Size of the control
|
|
|
|
/// \param style : Style of the control
|
2009-01-29 00:18:34 +08:00
|
|
|
///
|
|
|
|
////////////////////////////////////////////////////////////
|
2009-07-12 06:17:24 +08:00
|
|
|
wxSFMLCanvas(wxWindow* parent = NULL, wxWindowID id = -1, const wxPoint& position = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
|
2009-01-29 00:18:34 +08:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// Destructor
|
|
|
|
///
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
virtual ~wxSFMLCanvas();
|
|
|
|
|
|
|
|
private :
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// Notification for the derived class that moment is good
|
|
|
|
/// for doing its update and drawing stuff
|
|
|
|
///
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
virtual void OnUpdate();
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// Called when the window is idle - we can refresh our
|
|
|
|
/// SFML window
|
|
|
|
///
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
void OnIdle(wxIdleEvent&);
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// Called when the window is repainted - we can display our
|
|
|
|
/// SFML window
|
|
|
|
///
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
void OnPaint(wxPaintEvent&);
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
/// Called when the window needs to draw its background
|
|
|
|
///
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
void OnEraseBackground(wxEraseEvent&);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // WXSFMLCANVAS_HPP
|