示例#1
0
void Circles::draw(){
    
    
    renderWave();
//    ofDrawBitmapString(ofToString(coeVariable), 100, 100);
    
}
void render(int step)
{
   ResourceManager& rm = ResourceManager::getInstance();

   ALLEGRO_BITMAP *bg = (ALLEGRO_BITMAP *)rm.getData(RES_BACKGROUND);

   if (shakeUpdateCount > 0) {
      shakeUpdateCount -= step;
      if (shakeUpdateCount <= 0) {
         shakeCount++;
         if (shakeCount >= SHAKE_TIMES) {
            shakeCount = 0;
            shakeUpdateCount = 0;
            bgx = bgy = 0;
         }
         else {
            bgx = randf(0.0f, 8.0f);
            bgy = randf(0.0f, 8.0f);
            if (rand() % 2) bgx = -bgx;
            if (rand() % 2) bgy = -bgy;
            shakeUpdateCount = SHAKE_TIME;
         }
      }
   }

   al_draw_scaled_bitmap(bg, 0, 0, 
      al_get_bitmap_width(bg), al_get_bitmap_height(bg), 
      bgx, bgy, BB_W, BB_H, 0);

   std::list<Entity *>::iterator it;
   for (it = entities.begin(); it != entities.end(); it++) {
      Entity *e = *it;
      e->render_four(al_map_rgb(255, 255, 255));
      if (e->isHighlighted()) {
         al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE);
         e->render_four(al_map_rgb(150, 150, 150));
         al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA);
      }
   }

   Player *player = (Player *)rm.getData(RES_PLAYER);
   player->render_four(al_map_rgb(255, 255, 255));
   player->render_extra();

   if (waveAngle > 0.0f) {
      renderWave();
      waveAngle -= 0.003f * step;
      if (waveAngle <= 0.0f) {
         stopWave();
      }
   }

   al_flip_display();
}
void testApp::draw(){

    ofBackground(0);
    renderWave();

}
//--------------------------------------------------------------
void testApp::draw(){
	
	renderWave(); //this has all the drawing bits, so we put it in draw!
}