Пример #1
0
void QGLView::cameraChanged()
{
    // The pick buffer will need to be refreshed at the new camera position.
    d->pickBufferForceUpdate = true;

    // Queue an update for the next event loop.
    queueUpdate();
}
Пример #2
0
void PatchInspector::postRedo()
{
	// Update the PatchInspector after a redo operation
	queueUpdate();
}
Пример #3
0
void PatchInspector::onPatchTextureChanged()
{
	queueUpdate();
}
Пример #4
0
void PatchInspector::onPatchControlPointsChanged()
{
	queueUpdate();
}
Пример #5
0
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags): QMainWindow(parent, flags), petri_dish(),
    histogramDialog(0), changed(true), auto_save(false), update_thread(this, this)
{
    setupUi(this);

    connect(&timer, SIGNAL(timeout()), &petri_dish, SLOT(step()));
    connect(&petri_dish, SIGNAL(changed()), worldView, SLOT(queueUpdate()));
    //connect(&petri_dish, SIGNAL(changed()), worldView, SLOT(repaint()));
    connect(&petri_dish, SIGNAL(changed()), this, SLOT(set_stats()));
    connect(runButton, SIGNAL(clicked()), this, SLOT(start_stop()));
    //connect(checkIntegrity, SIGNAL(clicked()), this, SLOT(check_integrity()));
    connect(stepBtn, SIGNAL(clicked()), this, SLOT(step()));

    connect(radViewDefault, SIGNAL(clicked()), &petri_dish, SLOT(set_default_view_mode()));
    connect(radViewBugs, SIGNAL(clicked()), &petri_dish, SLOT(set_bugs_view_mode()));
    connect(radViewEnergy, SIGNAL(clicked()), &petri_dish, SLOT(set_energy_view_mode()));
    connect(radViewAge, SIGNAL(clicked()), &petri_dish, SLOT(set_age_view_mode()));
    connect(radViewSize, SIGNAL(clicked()), &petri_dish, SLOT(set_dna_size_view_mode()));
    connect(radViewDNA, SIGNAL(clicked()), &petri_dish, SLOT(set_dna_view_mode()));
    connect(radViewTerrain, SIGNAL(clicked()), &petri_dish, SLOT(set_terrain_view_mode()));

    connect(actionNew, SIGNAL(triggered()), this, SLOT(new_world()));
    connect(actionSave, SIGNAL(triggered()), this, SLOT(save_world()));
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(load_world()));
    connect(actionSave_As, SIGNAL(triggered()), this, SLOT(save_as_world()));
    connect(settings, SIGNAL(settingsChanged()), this, SLOT(change_world()));
    connect(actionAutoSave, SIGNAL(triggered()), this, SLOT(autosave_world()));

    connect(actionCheck_Integrity, SIGNAL(triggered()), this, SLOT(check_integrity()));

    connect(worldView, SIGNAL(clicked(int, int)), this, SLOT(edit_bug(int, int)));

    connect(idleChk, SIGNAL(clicked(bool)), this, SLOT(enableIdleDetect(bool)));

    connect(&idleTimer, SIGNAL(timeout()), this, SLOT(checkIdle()));

    autosave_timer.setInterval(1000 * 60 * 2); // every two mins
    connect(&autosave_timer, SIGNAL(timeout()), this, SLOT(save_world()));

    petri_dish.set_widget(worldView);
    petri_dish.init(settings->getParams());
    totalEnergy->setText(QString().setNum(petri_dish.get_total_energy()));
    spinDNAVal->setMaximum(settings->getParams().max_data);
    set_stats();

    last_time = 0;
    update_time.start();
    updates_per_sec = 0;


    //update_thread.start();
    horizontalSlider->setValue(1000);
    timer.start(0);

    setAttribute(Qt::WA_QuitOnClose, true);

    repaint();

    if(!qApp->arguments().size() > 1) {
        bool running;
        load_from_file(qApp->arguments().at(1), running);

        if(running) start();
    }
}