Back to index

libsfml  1.6+dfsg2
Classes | Functions
Main.cpp File Reference
#include "QSFMLCanvas.hpp"
#include <QApplication>
#include <QVBoxLayout>
#include <QFrame>
#include <QLabel>

Go to the source code of this file.


class  MyCanvas
 Custom SFML canvas /////////////////////////////////////////////////////////. More...


int main (int argc, char **argv)
 Entry point of application.

Function Documentation

int main ( int  argc,
char **  argv 

Entry point of application.

Application exit code


Definition at line 91 of file Main.cpp.

    QApplication App(argc, argv);

    // Create the main frame
    QFrame* MainFrame = new QFrame;
    MainFrame->setWindowTitle("Qt SFML");
    MainFrame->resize(400, 400);

    // Create a label for showing some text
    QLabel* Label = new QLabel("This is a SFML window\nembedded into a Qt frame :", MainFrame);
    Label->setFont(QFont("courier new", 14, 1, false));

    // Create a SFML view inside the main frame
    MyCanvas* SFMLView = new MyCanvas(MainFrame);

    // Create the main layout
    QVBoxLayout* Layout = new QVBoxLayout;
    Layout->addWidget(Label, 0);
    Layout->addWidget(SFMLView, 1);

    return App.exec();