示例#1
0
group_t* emitterEmit(emitter_t* emitter, double deltaT){
    part_t* part = NULL;
    group_t* group = NULL;
    
    if(!emitter) return group;
    
    // init
    vect_t speed;
    double speedAngle;
    double random = (double) rand() / RAND_MAX;
    
    // check random value
    if(random < deltaT * emitter->flow){
        part = partNew();
        partSetPos(part, emitter->pos);
        
        group = groupNew();
        groupSetPos(group, emitter->pos);
        
        // calculate speed
        speedAngle = emitter->alpha * (1.0 - 2.0 * rand() / RAND_MAX);
        speed.x = emitter->speed * cos(emitter->angle + speedAngle);
        speed.y = emitter->speed * sin(emitter->angle + speedAngle);
        groupSetSpeed(group, speed);
        
        groupSetType(group, GROUP_TYPE_HARMLESS);
        groupAdd(group, part);
    }
    
    return group;
}
示例#2
0
TaskSettings::TaskSettings(QWidget *p) : QDialog(p) {
	setupUi(this);
	connect(btnAdd, SIGNAL(clicked()), this, SLOT(groupAdd()));
	connect(btnRemove, SIGNAL(clicked()), this, SLOT(groupRemove()));
	connect(btnUp, SIGNAL(clicked()), this, SLOT(groupMoveUp()));
	connect(btnDown, SIGNAL(clicked()), this, SLOT(groupMoveDown()));
	connect(lstGroups, SIGNAL(currentRowChanged(int)), this, SLOT(groupRowChanged(int)));
	connect(lineGroup, SIGNAL(textChanged(QString)), this, SLOT(groupLineChanged(QString)));
}