コード例 #1
0
int
credits()
{
	Uint32 tick;
	SDL_Event mevent;

	drawCredits();

	tick=SDL_GetTicks();
	while(1) {
		while(SDL_PollEvent(&mevent)) {
    		if (mevent.type==SDL_QUIT)
    			return 0;
			if(mevent.type==SDL_KEYDOWN) {
				return 1;
			}
		}
		/* wait some time and return */
		if(SDL_GetTicks()-tick>10000) {
			/* pirutupiiii */
			if(sound && efx[7])
				Mix_PlayChannel(-1,efx[7],0);
			return 1;
		}
	}

	return 0;
}
コード例 #2
0
ファイル: main.c プロジェクト: Phillrb/vecpong
void runCredits(GameVars* gameVars)
{
#ifdef DEBUG
    debugPrint("CREDITS\x80");
#endif
    //Display credits
    drawCredits(0x80);
    
    //wait for user to go back with button 1
    readButton();
    
    //Player 1 Button 1 - Play
    if (_BTN_CUR_MASK & _JOY1_B1)
    {
        //Move to Play game state
        moveToNextGameState(gameVars, GENone);
    }
}
コード例 #3
0
ファイル: credits.c プロジェクト: BackupTheBerlios/gltron-svn
void displayCredits() {
  drawCredits();
  SystemSwapBuffers();
}
コード例 #4
0
ファイル: credits.c プロジェクト: BackupTheBerlios/gltron-svn
void displayCredits(void) {
  drawCredits();
  nebu_System_SwapBuffers();
}
コード例 #5
0
ファイル: Wish.cpp プロジェクト: thiagohersan/NotTooPublic
void Wish::update(){
    NotTooPublic::update();

    if(currentState == STATE_INTRO){
        stateLogicIntro();
    }
    else if(currentState == STATE_BLANK){
        stateLogicBlank();
    }
    else if(currentState == STATE_SPERM) {
        if(currentDistance <= 0.0){
            currentDistance = 0;
            lastStateChangeMillis = nowMillis;
            currentState = STATE_PAUSE;
        }
        else{
            currentDistance -= 1.0;
        }
    }
    else if(currentState == STATE_PAUSE) {
        if(nowMillis - lastStateChangeMillis > 2000){
            currentDistance = 0;
            lastStateChangeMillis = nowMillis;
            currentState = STATE_LINES;
        }
        else{
            //
        }
    }
    else if(currentState == STATE_LINES) {
        if(currentDistance > originalDistance){
            currentDistance = 0;
            lastStateChangeMillis = nowMillis;
            currentState = STATE_CLEAR;
        }
        else{
            currentDistance += 4.0f;
        }
    }
    else if(currentState == STATE_CLEAR) {
        if(currentDistance > originalDistance){
            currentDistance = originalDistance;
            lastStateChangeMillis = nowMillis;
            currentState = STATE_BLANK;
        }
        else{
            currentDistance += 4.0f;
        }
    }
    else if(currentState == STATE_OUTRO){
        stateLogicOutro();
    }

    ///// actual drawings
    if(currentState == STATE_INTRO){
        drawIntro();
    }

    if(currentState == STATE_OUTRO){
        drawCredits();
    }

    if(currentState == STATE_SPERM){
        fboCanvas.begin();
        ofEnableAlphaBlending();
        ofFill();
        // SPERM: ofSetColor(0, 24);
        ofSetColor(0, 64);
        ofRect(0,0, fboCanvas.getWidth(), fboCanvas.getHeight());
        ofPushMatrix();
        ofScale(currentMessageScaling, currentMessageScaling);
        ofTranslate((fboCanvas.getWidth()/currentMessageScaling-myFont.stringWidth(currentMessage))/2,
                    (fboCanvas.getHeight()/currentMessageScaling-myFont.stringHeight(currentMessage))/2+myFont.stringHeight("Tell"));

        ofFill();
        for(int i=0; i<currentMessagePath.size(); i++){
            ofVec3f center = currentMessagePath.at(i).getTessellation().getCentroid();
            for(int j=0; j<currentMessagePath.at(i).getOutline().size(); j++){
                for(int k=0; k<currentMessagePath.at(i).getOutline().at(j).size(); k++){
                    ofPoint tp = currentMessagePath.at(i).getOutline().at(j).getVertices().at(k);
                    ofVec3f direction = (tp-center).normalize();
                    tp += direction*max(0.0f,currentDistance);
                    if(!(k%(int)ceil(currentMessagePoints/1000.0f))){
                        // SPERM: int complexity = 24;
                        int complexity = 4;
                        float magnitude = 8.0f;
                        float dx = ofNoise(complexity*tp.x/fboCanvas.getWidth()+PI,
                                           complexity*tp.y/fboCanvas.getHeight()+PI,
                                           (float)(ofGetFrameNum())/120.0f+PI);
                        float dy = ofNoise(complexity*tp.x/fboCanvas.getWidth()-PI,
                                           complexity*tp.y/fboCanvas.getHeight()-PI,
                                           (float)(ofGetFrameNum())/130.0f-PI);
                        float a = magnitude*ofNoise(dy,dx,(float)(ofGetFrameNum())/100.0f);
                        ofSetColor(255);
                        ofCircle(tp.x-a+2*a*dx, tp.y-a+2*a*dy, 1.0);
                    }
                }
            }
        }
        ofPopMatrix();
        ofDisableAlphaBlending();
        fboCanvas.end();
    }

    if(currentState == STATE_PAUSE){
        fboCanvas.begin();
        ofEnableAlphaBlending();
        ofPushMatrix();
        ofScale(currentMessageScaling, currentMessageScaling);
        ofTranslate((fboCanvas.getWidth()/currentMessageScaling-myFont.stringWidth(currentMessage))/2,
                    (fboCanvas.getHeight()/currentMessageScaling-myFont.stringHeight(currentMessage))/2+myFont.stringHeight("Tell"));

        ofFill();
        ofSetColor(0,8);
        myFont.drawString(currentMessage, 0, 0);

        ofNoFill();
        ofSetColor(255,8);
        ofSetLineWidth(2);
        for(int i=0; i<currentMessagePath.size(); i++){
            ofBeginShape();
            ofVec3f center = currentMessagePath.at(i).getTessellation().getCentroid();
            for(int j=0; j<currentMessagePath.at(i).getOutline().size(); j++){
                ofNextContour();
                for(int k=0; k<currentMessagePath.at(i).getOutline().at(j).size(); k++){
                    ofPoint tp = currentMessagePath.at(i).getOutline().at(j).getVertices().at(k);
                    ofVertex(tp.x, tp.y);
                }
            }
            ofEndShape(true);
        }
        ofPopMatrix();
        ofDisableAlphaBlending();
        fboCanvas.end();
    }

    if(currentState == STATE_LINES){
        fboCanvas.begin();
        ofEnableAlphaBlending();
        ofFill();
        ofSetColor(0, 32);
        ofRect(0,0, fboCanvas.getWidth(), fboCanvas.getHeight());
        ofPushMatrix();
        ofScale(currentMessageScaling, currentMessageScaling);
        ofTranslate((fboCanvas.getWidth()/currentMessageScaling-myFont.stringWidth(currentMessage))/2,
                    (fboCanvas.getHeight()/currentMessageScaling-myFont.stringHeight(currentMessage))/2+myFont.stringHeight("Tell"));

        ofNoFill();
        ofSetLineWidth(1.5);
        for(int i=0; i<currentMessagePath.size(); i++){
            ofVec3f center = currentMessagePath.at(i).getTessellation().getCentroid();
            for(int j=0; j<currentMessagePath.at(i).getOutline().size(); j++){
                for(int k=0; k<currentMessagePath.at(i).getOutline().at(j).size(); k++){
                    ofPoint tp = currentMessagePath.at(i).getOutline().at(j).getVertices().at(k);
                    ofVec3f direction = (tp-center).normalize();
                    tp += direction*max(0.0f,currentDistance);
                    if(!(k%(int)ceil(currentMessagePoints/1000.0f))){
                        ofSetColor(255,128);
                        ofLine(center, tp);
                    }
                }
            }
        }
        ofSetColor(0);
        myFont.drawString(currentMessage, 0, 0);
        ofPopMatrix();
        ofDisableAlphaBlending();
        fboCanvas.end();
    }

    if(currentState == STATE_CLEAR){
        fboCanvas.begin();
        ofEnableAlphaBlending();
        ofFill();
        ofSetColor(0, 32);
        ofRect(0,0, fboCanvas.getWidth(), fboCanvas.getHeight());
        ofPushMatrix();
        ofScale(currentMessageScaling, currentMessageScaling);
        ofTranslate((fboCanvas.getWidth()/currentMessageScaling-myFont.stringWidth(currentMessage))/2,
                    (fboCanvas.getHeight()/currentMessageScaling-myFont.stringHeight(currentMessage))/2+myFont.stringHeight("Tell"));

        ofNoFill();
        ofSetLineWidth(1.5);
        for(int i=0; i<currentMessagePath.size(); i++){
            ofVec3f center = currentMessagePath.at(i).getTessellation().getCentroid();
            for(int j=0; j<currentMessagePath.at(i).getOutline().size(); j++){
                for(int k=0; k<currentMessagePath.at(i).getOutline().at(j).size(); k++){
                    ofPoint tp = currentMessagePath.at(i).getOutline().at(j).getVertices().at(k);
                    ofVec3f direction = (tp-center).normalize();
                    tp += direction*max(0.0f,currentDistance);
                    ofPoint maxDistance = tp+direction*originalDistance;
                    if(!(k%(int)ceil(currentMessagePoints/1000.0f))){
                        ofSetColor(255,128);
                        ofLine(maxDistance, tp);
                    }
                }
            }
        }
        ofSetColor(0);
        myFont.drawString(currentMessage, 0, 0);
        ofPopMatrix();
        ofDisableAlphaBlending();
        fboCanvas.end();
    }
}