示例#1
0
MainWindow::MainWindow(QWidget *parent)
    : QWidget(parent)
{
	screenRect = QApplication::desktop()->availableGeometry();
	setAutoFillBackground(false);
	setAttribute(Qt::WA_TranslucentBackground, true);
	//setAttribute(Qt::WA_NoSystemBackground, true);

	setGeometry(QRect(getRandomPos(screenRect, Mate::spriteSize()), Mate::spriteSize()));

	timerId = startTimer(TIMER_DELAY);
}
示例#2
0
void DrawWidget::addParticles()
{
    bool ok;
    static ParticleDialog *dialog = NULL;
    if(dialog == NULL)
        dialog = new ParticleDialog(this);
    ok = (dialog->exec() == QDialog::Accepted);
    if(ok)
    {
        ParticleProperties properties = dialog->getParticleProperties();

        std::vector<glm::vec3> particles;
        for(int i=0; i<properties.amount; ++i)
            particles.push_back(getRandomPos()*10.f + glm::vec3(0, 14, 0));
        sceneManager.addParticleGroup(properties, particles.data());

        if(renderer.isModernOpenGLAvailable())
            forward->compileShaders(sceneManager.getScene());
    }
}
示例#3
0
void MainWindow::timerEvent(QTimerEvent*)
{
	mate.moveToNextFrame();
	mate.act();
	move(pos() + mate.movement());

	if(geometry().bottom() > screenRect.bottom()) {
		QRect newGeometry = geometry();
		newGeometry.moveBottom(screenRect.bottom());
		setGeometry(newGeometry);

		mate.meetGround();
	} else if(!mate.isCaptured() && geometry().bottom() < screenRect.bottom()) {
		mate.startFalling();
	}

	if(getProb(PORTAL_PROB)) {
		move(getRandomPos(screenRect, Mate::spriteSize()));
		mate.startFalling();
	}

	update();
}