Minor updates to VC2008 project files
Better preprocessor detection of FreeBSD OS Improved the Qt sample git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1143 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
4af909c207
commit
1e8cb5827d
19 changed files with 98 additions and 70 deletions
|
@ -49,7 +49,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -127,7 +127,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -127,7 +127,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -123,7 +123,7 @@
|
|||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="2"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -126,7 +126,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4311;4312"
|
||||
/>
|
||||
|
@ -129,7 +129,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
DisableSpecificWarnings="4311;4312"
|
||||
/>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -127,7 +127,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -127,7 +127,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -127,7 +127,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -127,7 +127,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -126,7 +126,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -127,7 +127,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -128,7 +128,7 @@
|
|||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include "QSFMLCanvas.hpp"
|
||||
#include <Qt/qapplication.h>
|
||||
#include <Qt/qframe.h>
|
||||
#include <Qt/qlabel.h>
|
||||
#include <Qt/qevent.h>
|
||||
#include <QApplication>
|
||||
#include <QVBoxLayout>
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -20,8 +20,8 @@ public :
|
|||
/// Construct the canvas
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
MyCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size) :
|
||||
QSFMLCanvas(Parent, Position, Size)
|
||||
MyCanvas(QWidget* Parent = NULL) :
|
||||
QSFMLCanvas(QSize(100, 100), 0, Parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -54,8 +54,13 @@ private :
|
|||
// Stick the sprite to the mouse cursor
|
||||
if (Event.Type == sf::Event::MouseMoved)
|
||||
{
|
||||
mySprite.SetX(Event.MouseMove.X);
|
||||
mySprite.SetY(Event.MouseMove.Y);
|
||||
mySprite.SetPosition(ConvertCoords(Event.MouseMove.X, Event.MouseMove.Y));
|
||||
}
|
||||
|
||||
// Adjust the size of the default view when the widget is resized
|
||||
if (Event.Type == sf::Event::Resized)
|
||||
{
|
||||
GetDefaultView().SetHalfSize(Event.Size.Width / 2.f, Event.Size.Height / 2.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,13 +100,16 @@ int main(int argc, char **argv)
|
|||
|
||||
// Create a label for showing some text
|
||||
QLabel* Label = new QLabel("This is a SFML window\nembedded into a Qt frame :", MainFrame);
|
||||
Label->move(20, 10);
|
||||
Label->setFont(QFont("courier new", 14, 1, false));
|
||||
Label->show();
|
||||
|
||||
// Create a SFML view inside the main frame
|
||||
MyCanvas* SFMLView = new MyCanvas(MainFrame, QPoint(20, 60), QSize(360, 320));
|
||||
SFMLView->show();
|
||||
|
||||
MyCanvas* SFMLView = new MyCanvas(MainFrame);
|
||||
|
||||
// Create the main layout
|
||||
QVBoxLayout* Layout = new QVBoxLayout;
|
||||
Layout->addWidget(Label, 0);
|
||||
Layout->addWidget(SFMLView, 1);
|
||||
MainFrame->setLayout(Layout);
|
||||
|
||||
return App.exec();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include "QSFMLCanvas.hpp"
|
||||
#include <QEvent>
|
||||
|
||||
// Platform-specific headers
|
||||
#ifdef Q_WS_X11
|
||||
|
@ -14,10 +15,12 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the QSFMLCanvas
|
||||
////////////////////////////////////////////////////////////
|
||||
QSFMLCanvas::QSFMLCanvas(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime) :
|
||||
QWidget (Parent),
|
||||
myInitialized (false)
|
||||
QSFMLCanvas::QSFMLCanvas(const QSize& Size, unsigned int FrameTime, QWidget* Parent) :
|
||||
QWidget(Parent)
|
||||
{
|
||||
// Resize the widget
|
||||
resize(Size);
|
||||
|
||||
// Setup some states to allow direct rendering into the widget
|
||||
setAttribute(Qt::WA_PaintOnScreen);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
@ -26,10 +29,6 @@ myInitialized (false)
|
|||
// Set strong focus to enable keyboard events to be received
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
// Setup the widget geometry
|
||||
move(Position);
|
||||
resize(Size);
|
||||
|
||||
// Setup the timer
|
||||
myTimer.setInterval(FrameTime);
|
||||
}
|
||||
|
@ -74,12 +73,13 @@ QPaintEngine* QSFMLCanvas::paintEngine() const
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called when the widget is shown ;
|
||||
/// we use it to initialize our SFML window
|
||||
/// Called each time an event is received by the widget ;
|
||||
/// we use it to catch the Polish event and initialize
|
||||
/// our SFML window
|
||||
////////////////////////////////////////////////////////////
|
||||
void QSFMLCanvas::showEvent(QShowEvent*)
|
||||
bool QSFMLCanvas::event(QEvent* Event)
|
||||
{
|
||||
if (!myInitialized)
|
||||
if (Event->type() == QEvent::Polish)
|
||||
{
|
||||
// Under X11, we need to flush the commands sent to the server to ensure that
|
||||
// SFML will get an updated view of the windows
|
||||
|
@ -96,9 +96,9 @@ void QSFMLCanvas::showEvent(QShowEvent*)
|
|||
// Setup the timer to trigger a refresh at specified framerate
|
||||
connect(&myTimer, SIGNAL(timeout()), this, SLOT(repaint()));
|
||||
myTimer.start();
|
||||
|
||||
myInitialized = true;
|
||||
}
|
||||
|
||||
return QWidget::event(Event);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <Qt/qwidget.h>
|
||||
#include <Qt/qtimer.h>
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
class QEvent;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// QSFMLCanvas allows to run SFML in a Qt control
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -20,13 +22,12 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
/// Construct the QSFMLCanvas
|
||||
///
|
||||
/// \param Parent : Parent of the widget
|
||||
/// \param Position : Position of the widget
|
||||
/// \param Size : Size of the widget
|
||||
/// \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(QWidget* Parent, const QPoint& Position, const QSize& Size, unsigned int FrameTime = 0);
|
||||
QSFMLCanvas(const QSize& Size, unsigned int FrameTime = 0, QWidget* Parent = NULL);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destructor
|
||||
|
@ -57,11 +58,12 @@ private :
|
|||
virtual QPaintEngine* paintEngine() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called when the widget is shown ;
|
||||
/// we use it to initialize our SFML window
|
||||
/// Called each time an event is received by the widget ;
|
||||
/// we use it to catch the Polish event and initialize
|
||||
/// our SFML window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void showEvent(QShowEvent*);
|
||||
virtual bool event(QEvent* Event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Called when the widget needs to be painted ;
|
||||
|
@ -73,8 +75,7 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
QTimer myTimer; ///< Timer used to update the view
|
||||
bool myInitialized; ///< Tell whether the SFML window has been initialized or not
|
||||
QTimer myTimer; ///< Timer used to update the view
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -79,13 +79,8 @@ public :
|
|||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
MyFrame() :
|
||||
wxFrame(NULL, wxID_ANY, wxT("SFML wxWidgets"), wxDefaultPosition, wxSize(680, 280))
|
||||
wxFrame(NULL, wxID_ANY, wxT("SFML wxWidgets"), wxDefaultPosition, wxSize(440, 280))
|
||||
{
|
||||
// Error log text box
|
||||
wxTextCtrl* ErrorLog = new wxTextCtrl(this, wxID_ANY, wxT(""), wxPoint(440, 20), wxSize(200, 200), wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL);
|
||||
std::cerr.rdbuf(ErrorLog);
|
||||
std::cerr << "-- This is the error log --" << std::endl;
|
||||
|
||||
// Let's create a SFML view
|
||||
new MyCanvas(this, wxID_ANY, wxPoint(20, 20), wxSize(400, 200));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue