Пример #1
0
void XBScene1::drawIntoFBO()
{
    XBScene1GUI *myGUI = (XBScene1GUI *) gui;

    float windowScale = XBSettingsManager::getInstance().getWindowScale();

    fbo.begin();
    {
        ofPushMatrix();
        ofScale(windowScale, windowScale);
        if (showFacadeImage)
            templateImage.draw(0, 0);
        else
            ofBackground(0);

        if (showTemplate) {
            ofSetColor(255);
            svg.draw();
        }

        drawDirector();
        drawPiano();

        // draw time markers
        if (myGUI->showTimeMarker) {
            ofSetColor(220);
            ofDrawLine(0, violinTimeIndex, ofGetWidth() / windowScale, violinTimeIndex);
            ofDrawLine(celloTimeIndex, 0, celloTimeIndex, ofGetHeight() / windowScale);
        }

        if(myGUI->drawWindows)
            drawWindows();

        // mask for removing the windows
        if (maskWindows == true) {
            ofPushStyle();
            ofEnableBlendMode(OF_BLENDMODE_MULTIPLY);
            mask.draw(0, 0);
            ofPopStyle();
        }
        drawViolinCello();
        ofPopMatrix();
        drawMusiciansWindows();

        drawGUI();
    }
    fbo.end();
    blur.apply(&fbo, 1, myGUI->blurAmount);
    if(animating)
        myGUI->glowAmount.getParameter().cast<int>() = animtedGlowAmount;
    applyPostFX();
}
Пример #2
0
int main( int argc, char* args[] ){
  //Start up SDL and create window
  if( !init() ){
    printf( "Failed to initialize!\n" );
  }
  else{
    //Load media
    if( !loadMedia() ){
      printf( "Failed to load media!\n" );
    }
    else{
      //Main loop flag
      bool quit = false;

      //Event handler
      SDL_Event e;

      int whichKey;

      //While application is running
      while( !quit )
	{
	  //Handle events on queue
	  if( SDL_PollEvent( &e )){
	    //User requests quit
	    if( e.type == SDL_QUIT || (e.key.keysym.sym==SDLK_q)){
	      quit = true;
	    }
	  }
	  //Clear screen
	  
	  SDL_SetRenderDrawColor( gRenderer, 255, 255, 255, 255);
	  SDL_RenderClear( gRenderer );
	  
	  drawPiano();
		int value=0;
	//int val=e.key.keysym.sym;
	//  switch(e.key.keysym.sym){
	if (e.type == SDL_KEYDOWN)
	//	SDLKEY keyPressed = e.key.keysym.sym;

		switch(e.key.keysym.sym){
	  		case 'a':
				value=1;
				break;
	  		case 's':
				value=2;
				break;
			case 'd':
				value=3;
				break;
			case 'f':
				value=4;
				break;
			case 'g':
				value=5;
				break;
			case 'h':
				value=6;
				break;
			case 'j':
				value=7;
				break;
			case 'k':
				value=8;
				break;
			case 'l':
				value=9;
				break;
			case ';':
				value=10;
				break;
			case 'w':
				value=11;
				break;
			case 'e':
				value=12;
				break;
			case 't':
				value=13;
				break;
			case 'y':
				value=14;
				break;
			case 'u':
				value=15;
				break;
			case 'o':
				value=16;
				break;
			case 'p':
				value=17;
				break;
	  }
		if(value != 0){
			highlightPiano(value);
			SDL_RenderPresent(gRenderer);
			SDL_Delay(500);
		}
	  SDL_RenderPresent(gRenderer);
	  drawPiano();
	}
    }
  }

  //Free resources and close SDL
  close();

  return 0;
}