示例#1
0
void MapWidget::exportSVGToDisplayCluster()
{
    if(g_dcSocket != NULL && svgTmpFile_.open())
    {
        QSvgGenerator generator;
        generator.setFileName(svgTmpFile_.fileName());
        generator.setResolution(90);
        generator.setSize(QSize(1400, 1200));
        generator.setViewBox(viewRect_);

        QPainter painter;
        painter.begin(&generator);

        // set logical coordinates of the render window
        painter.setWindow(viewRect_.toRect());

        // draw a black background
        painter.setBrush(QBrush(QColor::fromRgbF(0,0,0,1)));
        painter.drawRect(QRect(QPoint(-107,37), QPoint(-93,25)));

        renderAll(&painter, false);

        painter.end();

        put_flog(LOG_DEBUG, "wrote %s", svgTmpFile_.fileName().toStdString().c_str());

        // now, send it to DisplayCluster
        sendSVGToDisplayCluster((svgTmpFile_.fileName()).toStdString(), (QString("ExerciseMap-") + QString::number(index_) + ".svg").toStdString());
    }
}
示例#2
0
int main(int argc, char **argv)
{
    const char *database = (argc >= 2 ? argv[1] : "default");

    bool testMode = (argc >= 2 && strncmp(argv[1], "test", 4) == 0);

    initialiseConnection(database);
    initialiseBackup();
    initialiseLatex(database);

    if (argc >= 3 && strncmp(argv[2], "render-all", 12) == 0) {
        renderAll();
        exit(0);
    }

    QApplication app(argc, argv);

    QFont font;
    font.setFamily("Helvetica");
    font.setPointSize(18);
    app.setFont(font);

    if (testMode) {
        runAllTests();

        return 0;
    }
    else {
        StudyAidController controller;
        controller.openNewWindow();

        return app.exec();
    }
}
示例#3
0
void MapWidget::paintEvent(QPaintEvent* event)
{
    makeCurrent();

#if USE_OPENGL_ANTIALIASING
    // for antialiasing
    #ifndef WIN32
    glEnable(GL_MULTISAMPLE);
    #endif
    glEnable(GL_LINE_SMOOTH);
#endif

    QPainter painter(this);

    painter.setBackgroundMode(Qt::TransparentMode);

#if USE_OPENGL_ANTIALIASING
    painter.setRenderHint(QPainter::Antialiasing);
    painter.setRenderHint(QPainter::HighQualityAntialiasing);
#endif

    painter.setWindow(viewRect_.toRect());

    renderAll(&painter, true);
}
示例#4
0
//called by the main
void vRenderer::draw()
{
	//update any variables before doing the draw
	update();
	//finally render
	renderAll();
}
QImage OpenGLCompositor::grab()
{
    Q_ASSERT(m_context && m_targetWindow);
    m_context->makeCurrent(m_targetWindow);
    QScopedPointer<QOpenGLFramebufferObject> fbo(new QOpenGLFramebufferObject(m_targetWindow->geometry().size()));
    renderAll(fbo.data());
    return fbo->toImage();
}
示例#6
0
// Display game interface to be able to play
t_game    showGame(t_game game, int tempsActuel, int tempsPrecedent)
{
    if (game.Gevenements.type == SDL_KEYDOWN)
    {
        game.Gplayer1 = movePlayer(game);
        if (game.Gevenements.key.keysym.sym == SDLK_SPACE && game.Gplayer1.nbr_bullet < 2)
        {
            Mix_PlayChannel(-1, game.Gplayer1.bulletGo_sound, 0);
            game.Gplayer1.bullet[game.Gplayer1.nbr_bullet].bullet = loadBullet(game);
            game.Gplayer1.bullet[game.Gplayer1.nbr_bullet].position = init_bulletPos(game.Gplayer1);
            game.Gplayer1.nbr_bullet++;
        }
    }
    // Si 15 ms se sont écoulées depuis le dernier tour de boucle
    if (tempsActuel - tempsPrecedent > 15) {
        game = launch_bullet(game);
        game = launch_bulletMonster(game);
        game = moveMonster(game);
    }
    
    renderAll(game);
    return (game);
}
void OpenGLCompositor::handleRenderAllRequest()
{
    Q_ASSERT(m_context && m_targetWindow);
    m_context->makeCurrent(m_targetWindow);
    renderAll(0);
}