コード例 #1
0
ファイル: testApp.cpp プロジェクト: MrMdR/julapy
//--------------------------------------------------------------
void testApp::setup()
{
	ofSetVerticalSync( true );
	ofSetFrameRate( 60 );
	
	bDebug = true;
	
	float offset = 60;
	
	path.init();
	path.addPoint( offset, offset );
	path.addPoint( ofGetWidth() - offset, offset );
	path.addPoint( ofGetWidth() - offset, ofGetHeight() - offset );
	path.addPoint( ofGetWidth() * 0.5, ofGetHeight() - offset * 3 );
	path.addPoint( offset, ofGetHeight() - offset );
	
	int noBoids;
	noBoids = 10;
	
	for( int i=0; i<noBoids; i++ )
	{
		addBoid
		(
			ofRandom( 0, ofGetWidth()  ),
			ofRandom( 0, ofGetHeight() )
		);
	}
}
コード例 #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    m_ui(new Ui::MainWindow)
{
    m_ui->setupUi(this);
    m_gl=new GLWindow(this);
    m_ui->s_mainwindowgridlayout->addWidget(m_gl,0,0,2,1);
    connect(m_ui->m_wireframe,SIGNAL(toggled(bool)),m_gl,SLOT(toggleWireframe(bool)));
    connect(m_ui->m_animateBoids ,SIGNAL(toggled(bool)),m_gl,SLOT(toggleBoidAnimation(bool)));
    connect(m_ui->m_animateGoal ,SIGNAL(toggled(bool)),m_gl,SLOT(toggleGoalAnimation(bool)));
    connect(m_ui->m_mass,SIGNAL(valueChanged(double)),m_gl,SLOT(setMass(double)));
    connect(m_ui->m_speed,SIGNAL(valueChanged(double)),m_gl,SLOT(setMaxSpeed(double)));
    connect(m_ui->m_force,SIGNAL(valueChanged(double)),m_gl,SLOT(setMaxForce(double)));
    connect(m_ui->m_seperation,SIGNAL(valueChanged(double)),m_gl,SLOT(setSepDist(double)));
    connect(m_ui->m_cohesion,SIGNAL(valueChanged(double)),m_gl,SLOT(setCohDist(double)));
    connect(m_ui->m_alignment,SIGNAL(valueChanged(double)),m_gl,SLOT(setAliDist(double)));
    connect(m_ui->m_addBoid,SIGNAL(pressed()),m_gl,SLOT(addBoid()));
    connect(m_ui->m_removeBoid,SIGNAL(pressed()),m_gl,SLOT(removeBoid()));

    connect(m_ui->m_goalInfluence,SIGNAL(sliderMoved(int)),m_gl,SLOT(setGoalInf(int)));
    connect(m_ui->m_resetGoals,SIGNAL(pressed()),m_gl,SLOT(resetGoals()));

    connect(m_ui->m_record ,SIGNAL(toggled(bool)),m_gl,SLOT(toggleRecord(bool)));

}
コード例 #3
0
int GLWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGLWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            toggleWireframe((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 1:
            toggleBoidAnimation((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 2:
            toggleGoalAnimation((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 3:
            toggleRecord((*reinterpret_cast< bool(*)>(_a[1])));
            break;
        case 4:
            setMass((*reinterpret_cast< double(*)>(_a[1])));
            break;
        case 5:
            setMaxSpeed((*reinterpret_cast< double(*)>(_a[1])));
            break;
        case 6:
            setMaxForce((*reinterpret_cast< double(*)>(_a[1])));
            break;
        case 7:
            setSepDist((*reinterpret_cast< double(*)>(_a[1])));
            break;
        case 8:
            setCohDist((*reinterpret_cast< double(*)>(_a[1])));
            break;
        case 9:
            setAliDist((*reinterpret_cast< double(*)>(_a[1])));
            break;
        case 10:
            setGoalInf((*reinterpret_cast< int(*)>(_a[1])));
            break;
        case 11:
            removeBoid();
            break;
        case 12:
            addBoid();
            break;
        case 13:
            resetGoals();
            break;
        default:
            ;
        }
        _id -= 14;
    }
    return _id;
}
コード例 #4
0
ファイル: testApp.cpp プロジェクト: MrMdR/julapy
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button)
{
	addBoid( x, y );
}