Esempio n. 1
0
//--------------------------------------------------------------
void pongScene::update(float mouseX, float mouseY){
	float mx = mouseX;
	float my = mouseY;
	
	if (fasterButton.update(mx, my)){
		ballVelocity.x *= 1.5;
		ballVelocity.y *= 1.5;
	}
	
	if (slowerButton.update(mx, my)){
		ballVelocity.x /= 1.5;
		ballVelocity.y /= 1.5;
	}
	
	float speed = 60.0f / MAX( ofGetFrameRate() , 5);
	//float speed = 1.5f;
	
	ballPoint.x += ballVelocity.x * speed;
	ballPoint.y += ballVelocity.y * speed;
	
	if (ballPoint.x < ballSize) {
		ballPoint.x = ballSize;
		ballVelocity.x *= -1;
	}
	if (ballPoint.x > ofGetWidth()-ballSize) {
		ballPoint.x = ofGetWidth()-ballSize;
		ballVelocity.x *= -1;
	}
	if (ballPoint.y < ballSize) {
		ballPoint.y = ballSize;
		ballVelocity.y *= -1;
	}
	
	if (ballPoint.y > ofGetHeight()-95){
		float diff = rectPoint.x - ballPoint.x;
		if (fabs(diff) < 110/2){
            reColor();
			ballPoint.y = ofGetHeight()-95;
			ballVelocity.y *= -1;
		}
	}
	
	if (ballPoint.y > ofGetHeight()){
		ballPoint.x = ofRandom(0,ofGetWidth());
		ballPoint.y = 20;
		ballVelocity.set(ofRandom(-5,5), ofRandom(2,9));
		
		
		
	}
	
	
	rectPoint.x = mx;
	rectPoint.y = ofGetHeight()-40;
}	
Esempio n. 2
0
const int CartridgeFinder::color(CString& strResult)
{
    int colorName(0);
    switch(reColor(strResult))
    {
    case rCL_Se:        reColorSe(strResult);        return TRUE;
	case rCL_ShortCode: reColorShortCode(strResult); return TRUE;
    case rCL_CrossTalk: reColorCrossTalk(strResult); return TRUE;
    case rCL_Nits:      reColorNits(strResult);      return TRUE;
    default:
//        ASSERT(0);
        return FALSE;
    }
}