mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
45b150648d
Removed the AudioResource class git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1166 4e206d99-4929-0410-ac5d-dfc041789085
85 lines
2.9 KiB
C++
85 lines
2.9 KiB
C++
|
|
#ifndef QSFMLCANVAS_HPP
|
|
#define QSFMLCANVAS_HPP
|
|
|
|
////////////////////////////////////////////////////////////
|
|
// Headers
|
|
////////////////////////////////////////////////////////////
|
|
#include <SFML/Graphics.hpp>
|
|
#include <QWidget>
|
|
#include <QTimer>
|
|
|
|
|
|
class QEvent;
|
|
|
|
////////////////////////////////////////////////////////////
|
|
/// QSFMLCanvas allows to run SFML in a Qt control
|
|
////////////////////////////////////////////////////////////
|
|
class QSFMLCanvas : public QWidget, public sf::RenderWindow
|
|
{
|
|
public :
|
|
|
|
////////////////////////////////////////////////////////////
|
|
/// Construct the QSFMLCanvas
|
|
///
|
|
/// \param size : Initial size of the widget
|
|
/// \param frameTime : Frame duration, in milliseconds (0 by default)
|
|
/// \param parent : Parent of the widget (NULL by default)
|
|
///
|
|
////////////////////////////////////////////////////////////
|
|
QSFMLCanvas(const QSize& size, unsigned int frameTime = 0, QWidget* parent = NULL);
|
|
|
|
////////////////////////////////////////////////////////////
|
|
/// 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();
|
|
|
|
////////////////////////////////////////////////////////////
|
|
/// Return the paint engine used by the widget to draw itself
|
|
///
|
|
////////////////////////////////////////////////////////////
|
|
virtual QPaintEngine* paintEngine() const;
|
|
|
|
////////////////////////////////////////////////////////////
|
|
/// Called each time an event is received by the widget ;
|
|
/// we use it to catch the Polish event and initialize
|
|
/// our SFML window
|
|
///
|
|
/// \param event : Event's attributes
|
|
///
|
|
////////////////////////////////////////////////////////////
|
|
virtual bool event(QEvent* event);
|
|
|
|
////////////////////////////////////////////////////////////
|
|
/// 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
|
|
};
|
|
|
|
|
|
#endif // QSFMLCANVAS_HPP
|