Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
75
samples/qt/QSFMLCanvas.hpp
Normal file
75
samples/qt/QSFMLCanvas.hpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
|
||||
#ifndef QSFMLCANVAS_HPP
|
||||
#define QSFMLCANVAS_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <Qt/qwidget.h>
|
||||
#include <Qt/qtimer.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// QSFMLCanvas allows to run SFML in a Qt control
|
||||
////////////////////////////////////////////////////////////
|
||||
class QSFMLCanvas : public QWidget, public sf::RenderWindow
|
||||
{
|
||||
public :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the QSFMLCanvas
|
||||
///
|
||||
/// \param Parent : Parent of the widget
|
||||
/// \param Position : Position of the widget
|
||||
/// \param Size : Size of the widget
|
||||
/// \param FrameTime : Frame duration, in milliseconds (0 by default)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
QSFMLCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual ~QSFMLCanvas();
|
||||
|
||||
private :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Notification for the derived class that moment is good
|
||||
/// for doing initializations
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnInit();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Notification for the derived class that moment is good
|
||||
/// for doing its update and drawing stuff
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnUpdate();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called when the widget is shown ;
|
||||
/// we use it to initialize our SFML window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void showEvent(QShowEvent*);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called when the widget needs to be painted ;
|
||||
/// we use it to display a new frame
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
QTimer myTimer; ///< Timer used to update the view
|
||||
bool myInitialized; ///< Tell whether the SFML window has been initialized or not
|
||||
};
|
||||
|
||||
|
||||
#endif // QSFMLCANVAS_HPP
|
Loading…
Add table
Add a link
Reference in a new issue