void ofApp::draw(){ ofSetLineWidth(1); glPointSize(1); ofBackground(255); ofPushMatrix(); if(bHandy){ ofRotateZ(90.0); ofTranslate(0, -ofGetWindowWidth()); } ofPushMatrix(); ofTranslate(start_point); draw_bg(); draw_wave(); draw_audioStats(); ofPopMatrix(); draw_info(); ofPopMatrix(); // draw_vid(); }
void desenha_buffer(Buffer* buffer, int largura, int altura){ al_set_target_bitmap(buffer->buffer); al_clear_to_color(al_map_rgb(0, 0, 0)); for( int i = 0; i < buffer->n_escudos; i++ ) desenha_escudo( buffer->escudo[i] ); draw_wave(buffer->invasores); desenha_tanque(buffer->tanque); char strScore[100]; sprintf(strScore, "SCORE: %d", *(buffer->score)); al_draw_text(buffer->fonte, al_map_rgb(255,255,255), 0, 10, 0, strScore ); al_draw_text(buffer->fonte, al_map_rgb(255,255,255), buffer->largura_inicial/4*3, 10, ALLEGRO_ALIGN_RIGHT, "VIDAS"); for(int i=0; i< *(buffer->vidas); i++) al_draw_bitmap(get_imagem_tanque(buffer->tanque),10+ buffer->largura_inicial/4*3 + i*(al_get_bitmap_width(get_imagem_tanque(buffer->tanque))+10), 5, 0); al_flip_display(); al_set_target_backbuffer(buffer->display); al_draw_scaled_bitmap(buffer->buffer, 0, 0, buffer->largura_inicial, buffer->altura_inicial, 0, 0, largura, altura, 0); }
void desenha_buffer(Buffer* buffer, int largura, int altura){ al_set_target_bitmap(buffer->buffer); al_clear_to_color(al_map_rgb(0, 0, 0)); for( int i = 0; i < buffer->n_escudos; i++ ) desenha_escudo( buffer->escudo[i] ); draw_wave(buffer->invasores); if (buffer->ovni) desenha_nave(buffer->ovni); desenha_tanque(buffer->tanque); char strScore[100], strVidas[5]; sprintf(strScore, "SCORE: %d", *(buffer->score)); sprintf(strVidas, "X %d", *(buffer->vidas)); al_draw_text(buffer->fonte, al_map_rgb(255,255,255), 0, 10, 0, strScore ); al_draw_bitmap(get_imagem_tanque(buffer->tanque),10+ buffer->largura_inicial/5*3 , 5, 0); al_draw_text(buffer->fonte, al_map_rgb(255,255,255), buffer->largura_inicial/4*3, 10, 0, strVidas); al_flip_display(); al_set_target_backbuffer(buffer->display); al_draw_scaled_bitmap(buffer->buffer, 0, 0, buffer->largura_inicial, buffer->altura_inicial, 0, 0, largura, altura, 0); }
/* Draws the song listing */ static void draw_listing() { float y = 92.0f; int i, esel; // printf("DEBUG: List size %d\r\n",lst_size); /* Draw all the song titles */ // for (i=0; i<14 && (top+i)<num_entries; i++) { for(i = 0; i < 10 && (top + i) < num_entries; i++) { int li; draw_poly_strf(32.0f, y, 100.0f, 1.0f, 1.0f, 1.0f, 1.0f, "%s", entries[top + i].fn); if(entries[top + i].size >= 0) { draw_poly_strf(32.0f + 240.0f, y, 100.0f, 1.0f, 1.0f, 1.0f, 1.0f, "%d bytes", entries[top + i].size); } else { draw_poly_strf(32.0f + 240.0f, y, 100.0f, 1.0f, 1.0f, 1.0f, 1.0f, "<DIR>"); } /* Check for playlist entries */ for(li = 0; li < lst_size; li++) { strcat(workstring, curdir); strcat(workstring, "/"); strcat(workstring, entries[top + i].fn); // printf("%s =? %s \r\n",workstring,lst_entries[li].fn); if(!(strcmp(workstring, lst_entries[li].fn))) { draw_poly_strf(36.0f + 32.0f + 360.0f, y, 100.0f, 1.0f, 1.0f, 1.0f, 1.0f, "%2d", li + 1); } if(!(strcmp(workstring, lst_entries[lst_playing].fn))) { draw_poly_box(31.0f, y - 1.0f, 609.0f, y + 25.0f, 90.0f, throb, 0.0f, 0.2f, 0.2f, throb, 0.0f, throb, 0.2f); } workstring[0] = 0; } y += 24.0f; } /* Put a highlight bar under one of them */ esel = (selected - top); draw_poly_box(31.0f, 92.0f + esel * 24.0f - 1.0f, 609.0f, 92.0f + esel * 24.0f + 25.0f, 95.0f, throb, throb, 0.2f, 0.2f, throb, throb, 0.2f, 0.2f); /* Put a hightlight bar under the playing file */ /* Only works correctly if you're in the same dir as the played file */ if((sndoggvorbis_isplaying() && !(strcmp(playdir, curdir)) && (lst_size == 0))) { esel = (iplaying - top); draw_poly_box(31.0f, 92.0f + esel * 24.0f - 1.0f, 609.0f, 92.0f + esel * 24.0f + 25.0f, 90.0f, throb, 0.0f, 0.2f, 0.2f, throb, 0.0f, throb, 0.2f); } if(sndoggvorbis_isplaying()) { draw_wave(); } }