Exemple #1
0
static void myinit(void)
{
    char i = 1;

    /* Init animation variables */
    leg = 0;
    shoulder1 = 0;
    shoulder2 = 0;
    shoulder3 = 0;
    shoulder4 = 0;
    lat1 = 20;
    lat2 = 20;
    elbow1 = 0;
    elbow2 = 0;
    pivot = 0;
    tilt = 10;
    ankle1 = 0;
    ankle2 = 0;
    heel1 = 0;
    heel2 = 0;
    hip11 = 0;
    hip12 = 10;
    hip21 = 0;
    hip22 = 10;
    fire = 0;
    solid_part = 1;
    turn = 0;
    turn1 = 0;
    lightturn = 0;
    lightturn1 = 0;
    elevation = 0.0;
    distance = 0.0;
    frame = 3.0;

#ifdef LIGHT
    SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
    glEnable(GL_DEPTH_TEST);
    MechTorso(i);
    MechHip(i);
    Shoulder(i);
    RocketPod(i);
    UpperArm(i);
    ForeArm(i);
    UpperLeg(i);
    Foot(i);
    VulcanGun(i);
    Enviro(i);
}
Exemple #2
0
//--------------------------------------------------------------
void JiveScreen::moveForwardsSlave(ofVec2f target, vector< vector<int> > choreo, int mStep, char gender)
{
    ofVec2f origin = getStepPosition(choreo, mStep);
    char side = getStepSide(choreo, mStep);
    ofVec2f oldtarget = target;
    
    if(positionUpdate != target)
    {
        tweenPositionSlave(footPositions, positionUpdate, target, choreo, mStep, side, gender, false, false, true, false);
    }
    else
    {
        if(gender == 'f')
        {
            ofPushMatrix();
            if(side == 'r') ofTranslate(0, -boxHeight);
            Foot(footPositions.at(footPositions.size()-1).x, footPositions.at(footPositions.size()-1).y - 2*config.distanceMoveJive, side, gender, config.iconSize);
            ofPopMatrix();
        }
        else{
            Foot(footPositions.at(footPositions.size()-1).x, footPositions.at(footPositions.size()-1).y, side, gender, config.iconSize);
        }
    }
}
Exemple #3
0
//--------------------------------------------------------------
ofVec2f JiveScreen::moveForwardsMaster(vector< vector<int> > choreo, int mStep, char gender)
{
    ofVec2f origin = getStepPosition(choreo, mStep);
    char side = getStepSide(choreo, mStep);
    ofVec2f target;
    target.x = origin.x;
    target.y = origin.y+config.distanceMoveJive;
    
    if(footPositions.size() == 0) positionUpdate = origin;
    if(positionUpdate != target)
    {
        tweenPositionMaster(footPositions, positionUpdate, origin, target, choreo, mStep, side, gender, false, true, false, true, false);
    }else{
        Foot(target.x, target.y, side, gender, config.iconSize);
    }
    
    return target;
}
Exemple #4
0
void
init(void) {
	char i = 1;

#ifdef LIGHT
	SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2);
#endif
	glEnable(GL_DEPTH_TEST);
	MechTorso(i);
	MechHip(i);
	Shoulder(i);
	RocketPod(i);
	UpperArm(i);
	ForeArm(i);
	UpperLeg(i);
	Foot(i);
	VulcanGun(i);
	Enviro(i);
}
Exemple #5
0
//--------------------------------------------------------------
void JiveScreen::getChoreoPosition(int step, char gender, bool displayPrevious, vector< vector<int> > choreo, bool bdisplayIcon, bool bisStart)
{
    // CURRENT POSITION ----------------------------------------
    char side;
    if(choreo[step][2] == 0)
    {
        positionCurr.x = choreo[step][0]-config.distanceFeet;
        side = 'l';
    }
    else
    {
        positionCurr.x = choreo[step][0]+config.distanceFeet;
        side = 'r';
    }
    positionCurr.y = choreo[step][1];
    
    // DISPLAY STEP --------------------------------------------
    // set color
    ofSetColor(255);
    if(displayPrevious) ofSetColor(255, 127);
    
    Foot(positionCurr.x, positionCurr.y, side, gender, config.iconSize);
    
    int nextStep = step+2;
    if(nextStep == 8) nextStep = 0;
    if(nextStep == 9) nextStep = 1;
    
    if(bdisplayIcon) createIcon(positionCurr, choreo, nextStep, gender);
    
    // PREVIOUS STEP -------------------------------------------
    if(displayPrevious)
    {
        previousStep = step-1;
        if(previousStep == -1) previousStep = 7;
        ofPushMatrix();
        if(bisStart) ofTranslate(-boxWidth*2/7, 0);
        getChoreoPosition(previousStep, gender, false, choreo, bdisplayIcon, bisStart);
        ofPopMatrix();
    }
}
//--------------------------------------------------------------
void SalsaScreen::getChoreoPosition(int step, char gender, bool displayPrevious, vector< vector<int> > choreo, bool bdisplayIcon)
{
    // CURRENT POSITION ----------------------------------------
    char side;
    if(choreo[step][2] == 0)
    {
        positionCurr.x = choreo[step][0]-config.distanceFeet;
        side = 'l';
    }
    else
    {
        positionCurr.x = choreo[step][0]+config.distanceFeet;
        side = 'r';
    }
    positionCurr.y = choreo[step][1];
    
    // DISPLAY STEP --------------------------------------------
    // set color
    ofSetColor(255);
    if(displayPrevious) ofSetColor(255, 127);
    
    Foot(positionCurr.x, positionCurr.y, side, gender, config.iconSize);
    
    int nextStep = step+2;
    if(nextStep == 6) nextStep = 0;
    if(nextStep == 7) nextStep = 1;
    
    if(bdisplayIcon) createIcon(positionCurr, choreo, nextStep, gender);
    
    // PREVIOUS STEP -------------------------------------------
    if(displayPrevious)
    {
        previousStep = step-1;
        if(previousStep == -1) previousStep = 5;
        getChoreoPosition(previousStep, gender, false, choreo, bdisplayIcon);
    }
}
Exemple #7
0
//--------------------------------------------------------------
void JiveScreen::draw()
{
    currentPlayerPos = player.getPositionMS();
    
    if(player.getPosition() < 1.0)
    {
        currentPlayerPos = roundUp(currentPlayerPos/100);
        cout << currentPlayerPos << endl;
        
        // INDIVIDUAL PRACTICE ------------------------------------
        if(currentPlayerPos >= startPlayerPos_R1
           && currentPlayerPos <= stopPlayerPos_R1)
        {
            updateChoreoPosition(role, currentStep, true, true, false, false);
            
            if(role[currentStep][4] == 1){
                intervall = intervall1/2;
            }else{
                intervall = intervall1;
            }
            
            if(prevPlayerPos+intervall >= currentPlayerPos-4
               && prevPlayerPos+intervall <= currentPlayerPos)
            {
                currentStep++;
                if(currentStep > 7) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }

        // WAIT FOR NEXT PART -------------------------------------
        }else if (currentPlayerPos >= stopPlayerPos_R1
                  && currentPlayerPos <= startPlayerPos_R2)
        {
            standardPosition(role, 7, cX1, cY1, cX2, cY2);
            
        }

        // MOVE FORWARDS ------------------------------------------
        else if (currentPlayerPos >= startPlayerPos_R2
                 && currentPlayerPos <= stopPlayerPos_R2)
        {
            if(currentPlayerPos >= startPlayerPos_R2
               && currentPlayerPos <= startPlayerPos_R2+4)
            {
                standardPosition(role, 7, cX1, cY1, cX2, cY2);
                
                footPositions.clear();
            }
            
            // recalculate intervall
            if(role[currentStep][4] == 1){
                intervall = intervall1/2;
            }else{
                intervall = intervall1;
            }
            
            // FOOT 1
            // animate 1st
            if(currentPlayerPos >= startPlayerPos_R2
               && currentPlayerPos < startPlayerPos_R2+intervall)
            {
                mStepA = 7;
                mStepB = 6;
                
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                mFootA = moveForwardsMaster(role, mStepA, 'm');
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                moveForwardsSlave(mFootA, role, mStepA, 'f');
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX3, cY2);
                ofRotateZ(config.rotateZ-180);
                moveForwardsSlave(mFootA, role, mStepA, 'm');
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX4, cY2);
                ofRotateZ(config.rotateZ-180);
                moveForwardsSlave(mFootA, role, mStepA, 'f');
                ofPopMatrix();
            }
            
            // FOOT 2
            // reset for next foot
            if(currentPlayerPos >= startPlayerPos_R2+intervall
               && currentPlayerPos <= startPlayerPos_R2+intervall+4)
            {
                footPositions.clear();
            }
            // display 1st and animate 2nd
            if(currentPlayerPos >= startPlayerPos_R2+intervall
               && currentPlayerPos < startPlayerPos_R2+intervall+intervall)
            {
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), 'm', config.iconSize);  // right foot
                ofTranslate(-boxWidth*2/7, 0);
                mFootB = moveForwardsMaster(role, mStepB, 'm');                             // left foot
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), 'f', config.iconSize); // left
                ofTranslate(-boxWidth*2/7, 0);
                moveForwardsSlave(mFootB, role, mStepB, 'f');                                                    // right
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX3, cY2);
                ofRotateZ(config.rotateZ-180);
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), 'm', config.iconSize);  // right foot
                ofTranslate(-boxWidth*2/7, 0);
                moveForwardsSlave(mFootB, role, mStepB, 'm');                               // left foot
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX4, cY2);
                ofRotateZ(config.rotateZ-180);
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), 'f', config.iconSize); // left
                ofTranslate(-boxWidth*2/7, 0);
                moveForwardsSlave(mFootB, role, mStepB, 'f');                                                    // right
                ofPopMatrix();
            }
            
            // FINAL MOVE FORWARD FEET
            // display
            if(currentPlayerPos >= startPlayerPos_R2+intervall+intervall)
            {
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                mGender = 'm';
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y+65, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                mGender = 'f';
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX3, cY2);
                ofRotateZ(config.rotateZ-180);
                mGender = 'm';
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y+70, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX4, cY2);
                ofRotateZ(config.rotateZ-180);
                mGender = 'f';
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
                ofTranslate(-boxWidth*2/7, 0);
                Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
                ofPopMatrix();
            }
        }
        
        // PARTNER PRACTICE ---------------------------------------
        else if(currentPlayerPos >= startPlayerPos_R3
                && currentPlayerPos <= stopPlayerPos_R3)
        {
            if(currentPlayerPos >= startPlayerPos_R3
               && currentPlayerPos <= startPlayerPos_R3+4)
            {
                prevPlayerPos = currentPlayerPos;
                currentStep = 0;
                footPositions.clear();
            }
            
            if(role[currentStep][4] == 1){
                intervall = intervall2/2 - 1;
            }else{
                intervall = intervall2;
            }
            
            //cout << currentPlayerPos << " -> do " << currentStep << " :: prev " << positionPrev << " - curr " << positionCurr << " :: prevStep of side: " << previousSideStep << endl;
            
            updateChoreoPosition(role, currentStep, true, false, true, false);
            
            //cout << prevPlayerPos << " + " << intervall << " >=< " << currentPlayerPos << endl;
            if(prevPlayerPos+intervall >= currentPlayerPos-4
               && prevPlayerPos+intervall <= currentPlayerPos)
            {
                
                currentStep++;
                if(currentStep > 7) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }
        
        // BRIDGE TO FAST PART ------------------------------------
        }else if (currentPlayerPos >= stopPlayerPos_R3
                  && currentPlayerPos <= startPlayerPos_R4)
        {
            
            // leader 1
            ofPushMatrix();
            ofTranslate(cX1, cY1);
            ofRotateZ(config.rotateZ);
            mGender = 'm';
            Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y+65, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
            ofPopMatrix();
            
            // follower 1
            ofPushMatrix();
            ofTranslate(cX2, cY1);
            ofRotateZ(config.rotateZ);
            mGender = 'f';
            Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
            ofPopMatrix();
            
            // leader 2
            ofPushMatrix();
            ofTranslate(cX3, cY2);
            ofRotateZ(config.rotateZ-180);
            mGender = 'm';
            Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y+70, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
            ofPopMatrix();
            
            // follower 2
            ofPushMatrix();
            ofTranslate(cX4, cY2);
            ofRotateZ(config.rotateZ-180);
            mGender = 'f';
            Foot(mFootA.x, mFootA.y-2*config.distanceMoveJive, getStepSide(role, mStepA), mGender, config.iconSize);
            Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveJive-55, 'r', mGender, config.iconSize);
            ofTranslate(-boxWidth*2/7, 0);
            Foot(mFootB.x, mFootB.y-2*config.distanceMoveJive, getStepSide(role, mStepB), mGender, config.iconSize);
            Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveJive-80, 'l', mGender, config.iconSize);
            ofPopMatrix();
        }
        // PARTNER PRACTICE - FAST --------------------------------
        else if(currentPlayerPos >= startPlayerPos_R4
                && currentPlayerPos <= stopPlayerPos_R4)
        {
            if(currentPlayerPos >= startPlayerPos_R4
               && currentPlayerPos <= startPlayerPos_R4+4)
            {
                prevPlayerPos = currentPlayerPos;
                currentStep = 0;
                footPositions.clear();
            }
            
            if(role[currentStep][4] == 1){
                intervall = intervall3/2;
            }else{
                intervall = intervall3;
            }
            
            //cout << currentPlayerPos << " -> do " << currentStep << " :: prev " << positionPrev << " - curr " << positionCurr << " :: prevStep of side: " << previousSideStep << endl;
            
            updateChoreoPosition(role, currentStep, true, false, true, false);
            
            //cout << prevPlayerPos << " + " << intervall << " >=< " << currentPlayerPos << endl;
            if(prevPlayerPos+intervall >= currentPlayerPos-4
               && prevPlayerPos+intervall <= currentPlayerPos)
            {
                
                currentStep++;
                if(currentStep > 7) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }
        }
        
        // WAIT FOR NEXT PART -------------------------------------
        else if(currentPlayerPos <= stopPlayerPos_R4
                && currentPlayerPos != 0)
        {
            standardPosition(role, 7, cX1, cY1, cX2, cY2);
        }
    }
}
Exemple #8
0
//--------------------------------------------------------------
void JiveScreen::tweenPositionSlave(vector<ofVec2f> fP, ofVec2f posUpdate, ofVec2f positionCurr, vector< vector<int> > choreo, int step, char side, char gender, bool bdisplayIcon, bool bdisplayPrevious, bool bmoveForward, bool bcloser)
{
    // if lift
    if(choreo[step][3] == 5 && !bmoveForward)
    {
        fP.at(fP.size()-1) = positionCurr;
        posUpdate          = positionCurr;
        positionPrev       = positionCurr;
    }
    //cout << step << " - prev: " << positionPrev << " - curr: " << positionCurr << " --> update: " << posUpdate << "     out: " << fP.at(fP.size()-1) << endl;
    
    if (posUpdate != positionCurr)
    {
        int last = fP.size()-1;
        
        ofSetColor(255, 255, 255, 255);
        
        /*int distTotal = ofDist(positionPrev.x, positionPrev.y, positionCurr.x, positionCurr.y);
         int distUpdate = ofDist(fP.at(last).x, fP.at(last).y, positionCurr.x, positionCurr.y);
         //int alpha = ofMap(distUpdate, 0, distTotal, 75, 255);
         //int alpha = 255-255*distUpdate/distTotal;
         //ofSetColor(255, 255, 255, alpha);*/
        
        if(bmoveForward && gender == 'f')
        {
            Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
        }else if(step == 0)
        {
            ofPushMatrix();
            if(gender == 'm'){
                ofRotateZ(360-rotateDegree);
                Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
            }else{
                ofRotateZ(rotateDegree);
                Foot(fP.at(last).x, fP.at(last).y, side, gender, config.iconSize);
            }
            ofPopMatrix();
        }
        else{
            if(gender == 'm'){
                Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
            }else{
                Foot(fP.at(last).x, fP.at(last).y, side, gender, config.iconSize);
            }
        }
        
        //alpha = 255;
        //if(distUpdate < distTotal/4) alpha = 0;
        if(bdisplayIcon) createIcon(fP, choreo, step, gender);
        //ofSetColor(255, 255, 255, 255);
    }
    else
    {
        int last = fP.size()-1;
        
        if(bmoveForward && gender == 'f')
        {
            Foot(fP.at(last).x, -fP.at(last).y, side, gender, config.iconSize);
        }
        else
        {
            // if lift
            if(choreo[step][3] == 5 && !bmoveForward)
            {
                if(bdisplayIcon) createIcon(fP, choreo, step, gender);
                
                if(!biconWasBig && newIconSize  < config.iconSize+5) newIconSize += 1;
                if(                newIconSize == config.iconSize+5) biconWasBig = true;
                if( biconWasBig && newIconSize >= config.iconSize)   newIconSize -= 1;
            }else{
                // reset
                biconWasBig = false;
                newIconSize = config.iconSize;
            }
            
            if(step == 0)
            {
                ofPushMatrix();
                if(gender == 'm'){
                    ofRotateZ(360-rotateDegree);
                    Foot(fP.at(last).x, -fP.at(last).y, side, gender, newIconSize);
                }else{
                    ofRotateZ(rotateDegree);
                    Foot(fP.at(last).x, fP.at(last).y, side, gender, newIconSize);
                }
                ofPopMatrix();
            }
            else
            {
                if(gender == 'm'){
                    Foot(fP.at(last).x, -fP.at(last).y, side, gender, newIconSize);
                }else{
                    Foot(fP.at(last).x, fP.at(last).y, side, gender, newIconSize);
                }
            }
        }
        
        //if(bdisplayIcon) createIcon(fP, choreo, step, gender);
    }
    
    if(bdisplayPrevious)
    {
        // PREVIOUS STEP --------------------------------------------
        previousStep = step-1;
        if(previousStep == -1) previousStep = 7;
        
        // get position
        ofVec2f previousStepPos;
        if(choreo[previousStep][2] == 0)
        {
            previousStepPos.x = choreo[previousStep][0]-config.distanceFeet;
            side = 'l';
        }
        else
        {
            previousStepPos.x = choreo[previousStep][0]+config.distanceFeet;
            side = 'r';
        }
        //if(previousStep == 0) previousStepPos.x = choreo[previousStep][0]-config.distanceFeet;
        previousStepPos.y = choreo[previousStep][1];
        
        // display step
        ofSetColor(255, 127);
        if(previousStep == 0)
        {
            ofPushMatrix();
            if(gender == 'm'){
                ofRotateZ(360-rotateDegree);
                Foot(previousStepPos.x, -previousStepPos.y, side, gender, config.iconSize);
            }else{
                ofRotateZ(rotateDegree);
                Foot(previousStepPos.x, previousStepPos.y, side, gender, config.iconSize);
            }
            ofPopMatrix();
        }
        else
        {
            if(gender == 'm'){
                Foot(previousStepPos.x, -previousStepPos.y, side, gender, config.iconSize);
            }else{
                Foot(previousStepPos.x, previousStepPos.y, side, gender, config.iconSize);
            }
        }

        int futureStep = previousStep+2;
        if(futureStep == 8) futureStep = 0;
        if(futureStep == 9) futureStep = 1;
        if(bdisplayIcon) createIcon(previousStepPos, choreo, futureStep, gender);
        ofSetColor(255, 255);
    }
}
Exemple #9
0
//--------------------------------------------------------------
void JiveScreen::tweenPositionMaster(vector<ofVec2f> fP, ofVec2f posUpdate, ofVec2f positionPrev, ofVec2f positionCurr, vector< vector<int> > choreo, int step, char side, char gender, bool bdisplayIcon, bool bdisplayMaster, bool bdisplayPrevious, bool bmoveForward, bool bcloser)
{  
    if(fP.size() == 0)
    {
        fP.resize(1);
        posUpdate = positionPrev;
    }
    if(posUpdate != positionCurr)
    {
        for(int i=0; i<fP.size()-1; i++)
        {
            fP[i] = fP[i+1];
        }
        fP.push_back(posUpdate);
        
        
        if(posUpdate.x < positionCurr.x)
        {
            posUpdate.x += 15;
            if(posUpdate.x > positionCurr.x) posUpdate.x = positionCurr.x;
        }
        else if(posUpdate.x > positionCurr.x)  {
            posUpdate.x -= 15;
            if(posUpdate.x < positionCurr.x) posUpdate.x = positionCurr.x;
        }
        
        if(posUpdate.y < positionCurr.y)
        {
            posUpdate.y += 15;
            if(posUpdate.y > positionCurr.y) posUpdate.y = positionCurr.y;
        }
        else if(posUpdate.y > positionCurr.y)
        {
            posUpdate.y -= 15;
            if(posUpdate.y < positionCurr.y) posUpdate.y = positionCurr.y;
        }
        
        
        int last = fP.size()-1;
        
        int distTotal = ofDist(positionPrev.x, positionPrev.y, positionCurr.x, positionCurr.y);
        int distUpdate = ofDist(fP.at(last).x, fP.at(last).y, positionCurr.x, positionCurr.y);
        int alpha = 255-255*distUpdate/distTotal;
        if(bmoveForward) alpha = 255;
        ofSetColor(255, 255, 255, alpha);
        
        if(bdisplayMaster)
        {
            Foot(fP.at(last).x, fP.at(last).y, side, gender, config.iconSize);
            
            if(bdisplayIcon) createIcon(fP, choreo, step, gender);
        }
    }
    else
    {
        if(bdisplayMaster)
        {
            // display step -----------------------------------------------------------------
            Foot(positionCurr.x, positionCurr.y, side, gender, config.iconSize);
            
            if(bdisplayIcon) createIcon(positionCurr, choreo, step, gender);
        }
    }
    
    if(bdisplayPrevious)
    {
        // PREVIOUS STEP --------------------------------------------
        previousStep = step-1;
        if(previousStep == -1) previousStep = 7;
        
        // get position
        ofVec2f previousStepPos;
        if(choreo[previousStep][2] == 0)
        {
            previousStepPos.x = choreo[previousStep][0]-config.distanceFeet;
            side = 'l';
        }
        else
        {
            previousStepPos.x = choreo[previousStep][0]+config.distanceFeet;
            side = 'r';
        }
        previousStepPos.y = choreo[previousStep][1];
        
        // display step
        ofSetColor(255, 127);
        if(bdisplayMaster) Foot(previousStepPos.x, previousStepPos.y, side, gender, config.iconSize);
        ofSetColor(255, 255);
    }
    
    // STORE values globally ----------------------------------
    footPositions       = fP;
    positionUpdate      = posUpdate;
}
Exemple #10
0
//--------------------------------------------------------------
void SalsaScreen::draw()
{
    currentPlayerPos = player.getPositionMS();
    
    if(player.getPosition() < 1.0)
    {
        currentPlayerPos = roundUp(currentPlayerPos/100);
        cout << currentPlayerPos << endl;
        
        if(currentPlayerPos >= startPlayerPos_R1
           && currentPlayerPos <= stopPlayerPos_R1)
        {
            updateChoreoPosition(role, currentStep, true, true, false, false);
            
            if(prevPlayerPos+intervall1 >= currentPlayerPos-4
               && prevPlayerPos+intervall1 <= currentPlayerPos)
            {
                currentStep++;
                if(currentStep > 5) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }
        }else if (currentPlayerPos >= stopPlayerPos_R1
                  && currentPlayerPos <= startPlayerPos_R2)
        {
            standardPosition(role, 5, cX1, cY1, cX2, cY2);
            
        }
        else if (currentPlayerPos >= startPlayerPos_R2
                 && currentPlayerPos <= stopPlayerPos_R2)
        {
            if(currentPlayerPos >= startPlayerPos_R2
               && currentPlayerPos <= startPlayerPos_R2+4)
            {
                standardPosition(role, 5, cX1, cY1, cX2, cY2);
                
                footPositions.clear();
            }
            if(currentPlayerPos >= startPlayerPos_R2
               && currentPlayerPos < startPlayerPos_R2+intervall1)
            {
                mStepA = 5;
                mStepB = 4;
                
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                mFootA = moveForwardsMaster(role, mStepA, 'm');
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2+boxHeight, cY1);
                ofRotateZ(config.rotateZ);
                moveForwardsSlave(mFootA, role, mStepA, 'f');
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX1, cY2);
                ofRotateZ(config.rotateZ);
                moveForwardsSlave(mFootA, role, mStepA, 'm');
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofRotateZ(config.rotateZ);
                ofTranslate(cX2+boxHeight, cY2);
                moveForwardsSlave(mFootA, role, mStepA, 'f');
                ofPopMatrix();
            }
            if(currentPlayerPos >= startPlayerPos_R2+intervall1
               && currentPlayerPos <= startPlayerPos_R2+intervall1+4)
            {
                footPositions.clear();
            }
            if(currentPlayerPos >= startPlayerPos_R2+intervall1
               && currentPlayerPos < startPlayerPos_R2+intervall1+intervall1)
            {
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), 'm', config.iconSize);  // right foot
                mFootB = moveForwardsMaster(role, mStepB, 'm');                             // left foot
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveSalsa, getStepSide(role, mStepA), 'f', config.iconSize); // left
                ofTranslate(0, boxHeight);
                moveForwardsSlave(mFootB, role, mStepB, 'f');                                                    // right
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX1, cY2);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), 'm', config.iconSize);  // right foot
                moveForwardsSlave(mFootB, role, mStepB, 'm');                               // left foot
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX2, cY2);
                ofRotateZ(config.rotateZ);
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveSalsa, getStepSide(role, mStepA), 'f', config.iconSize); // left
                ofTranslate(0, boxHeight);
                moveForwardsSlave(mFootB, role, mStepB, 'f');                                                    // right
                ofPopMatrix();
            }
            if(currentPlayerPos >= startPlayerPos_R2+intervall1+intervall1)
            {
                // leader 1
                ofPushMatrix();
                ofTranslate(cX1, cY1);
                ofRotateZ(config.rotateZ);
                mGender = 'm';
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
                Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y+65, 'r', mGender, config.iconSize);
                Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // follower 1
                ofPushMatrix();
                ofTranslate(cX2, cY1);
                ofRotateZ(config.rotateZ);
                mGender = 'f';
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveSalsa, getStepSide(role, mStepA), mGender, config.iconSize);
                Foot(mFootB.x, mFootB.y-2*config.distanceMoveSalsa, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveSalsa-55, 'r', mGender, config.iconSize);
                Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveSalsa-80, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // leader 2
                ofPushMatrix();
                ofTranslate(cX1, cY2);
                ofRotateZ(config.rotateZ);
                mGender = 'm';
                Foot(mFootA.x, mFootA.y, getStepSide(role, mStepA), mGender, config.iconSize);
                Foot(mFootB.x, mFootB.y, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y+70, 'r', mGender, config.iconSize);
                Hand(mFootB.x-160, mFootB.y+50, 'l', mGender, config.iconSize);
                ofPopMatrix();
                
                // follower 2
                ofPushMatrix();
                ofTranslate(cX2, cY2);
                ofRotateZ(config.rotateZ);
                mGender = 'f';
                Foot(mFootA.x, mFootA.y-2*config.distanceMoveSalsa, getStepSide(role, mStepA), mGender, config.iconSize);
                Foot(mFootB.x, mFootB.y-2*config.distanceMoveSalsa, getStepSide(role, mStepB), mGender, config.iconSize);
                Hand(mFootA.x+180, mFootA.y-2*config.distanceMoveSalsa-55, 'r', mGender, config.iconSize);
                Hand(mFootB.x-130, mFootB.y-2*config.distanceMoveSalsa-80, 'l', mGender, config.iconSize);
                ofPopMatrix();
            }
        }
        else if(currentPlayerPos >= startPlayerPos_R3
                && currentPlayerPos <= stopPlayerPos_R3)
        {
            if(currentPlayerPos >= startPlayerPos_R3
               && currentPlayerPos <= startPlayerPos_R3+4)
            {
                prevPlayerPos = currentPlayerPos;
                currentStep = 0;
                footPositions.clear();
            }
            
            //cout << currentPlayerPos << " -> do " << currentStep << " :: prev " << positionPrev << " - curr " << positionCurr << " :: prevStep of side: " << previousSideStep << endl;
            
            updateChoreoPosition(role, currentStep, true, false, true, false);
            
            //cout << prevPlayerPos << " + " << intervall << " >=< " << currentPlayerPos << endl;
            if(prevPlayerPos+intervall1 >= currentPlayerPos-4
               && prevPlayerPos+intervall1 <= currentPlayerPos)
            {
                
                currentStep++;
                if(currentStep > 5) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }
        }
        else if(currentPlayerPos >= startPlayerPos_R4
                && currentPlayerPos <= stopPlayerPos_R4)
        {
            if(currentPlayerPos >= startPlayerPos_R4
               && currentPlayerPos <= startPlayerPos_R4+4)
            {
                prevPlayerPos = currentPlayerPos;
                currentStep = 0;
                footPositions.clear();
            }
            
            //cout << currentPlayerPos << " -> do " << currentStep << " :: prev " << positionPrev << " - curr " << positionCurr << " :: prevStep of side: " << previousSideStep << endl;
            
            updateChoreoPosition(role, currentStep, true, false, true, false);
            
            //cout << prevPlayerPos << " + " << intervall << " >=< " << currentPlayerPos << endl;
            if(prevPlayerPos+intervall2 >= currentPlayerPos-4
               && prevPlayerPos+intervall2 <= currentPlayerPos)
            {
                
                currentStep++;
                if(currentStep > 5) currentStep = 0;
                isStart = false;
                
                prevPlayerPos = currentPlayerPos;
                
                // reset history
                footPositions.clear();
            }
        }
        else if(currentPlayerPos <= stopPlayerPos_R4
                && currentPlayerPos != 0)
        {
            standardPosition(role, 5, cX1, cY1, cX2, cY2);
        }
    }
}