static void draw_page(void) { int n = ACTIVE_PAGE.total_widgets; if (ACTIVE_PAGE.draw_full) { ACTIVE_PAGE.draw_full(); } else { draw_page_title(); if (ACTIVE_PAGE.draw_const) ACTIVE_PAGE.draw_const(); if (ACTIVE_PAGE.predraw_hook) ACTIVE_PAGE.predraw_hook(); } /* this doesn't use widgets[] because it needs to draw the page's * widgets whether or not a dialog is active */ while (n--) draw_widget(ACTIVE_PAGE.widgets + n, n == ACTIVE_PAGE.selected_widget); /* redraw the area over the menu if there is one */ if (status.dialog_type & DIALOG_MENU) menu_draw(); else if (status.dialog_type & DIALOG_BOX) dialog_draw(); }
void display(void) { char tmps[128]; float rf; // setup projection and modelview matrices glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, DS_WIDTH, 0, DS_HEIGHT, -1, 1); glScalef(1, -1, 1); glTranslatef(0, -DS_HEIGHT, 0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // clear the back buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // enable stuff glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // draw the current page switch (cpage) { case MAIN_PAGE1: synth_draw(); break; case MAIN_PAGE2: patch_draw(); break; case MAIN_PAGE3: pattern_draw(); break; case MAIN_PAGE4: sequencer_draw(); break; default: break; } // global ui elements console_print(6, DS_HEIGHT-27); main_ui[cpage]|=2; draw_button(DS_WIDTH-159, DS_HEIGHT-14, 16, "1", main_ui[MAIN_PAGE1]); draw_button(DS_WIDTH-137, DS_HEIGHT-14, 16, "2", main_ui[MAIN_PAGE2]); draw_button(DS_WIDTH-115, DS_HEIGHT-14, 16, "3", main_ui[MAIN_PAGE3]); draw_button(DS_WIDTH-93, DS_HEIGHT-14, 16, "4", main_ui[MAIN_PAGE4]); draw_textbox(DS_WIDTH-42, DS_HEIGHT-14, 16, 74, "komposter", main_ui[MAIN_ABOUT]); main_ui[cpage]&=1; // draw vu peak meter rf=fmin(1.0f, audio_latest_peak); rf=(0.2*lastrf) + (0.8*rf); // damping lastrf=rf; draw_textbox(728, DS_HEIGHT-14, 16, 100, "", main_ui[MAIN_VU]); glColor4f(0.68f, 0.33f, 0.0f, 0.94f); glBegin(GL_QUADS); glVertex2f(678, DS_HEIGHT-22); glVertex2f(678 + rf*100, DS_HEIGHT-22); glVertex2f(678 + rf*100, DS_HEIGHT-6); glVertex2f(678, DS_HEIGHT-6); glEnd(); sprintf(tmps, "%1.2f", audio_peak); render_text(tmps, 728, DS_HEIGHT-11, 2, (audio_peak > 1.0f) ? 0xffff8080 : 0xffffffff, 1); // if a dialog is active, dim the screen and draw it if (is_dialog()) dialog_draw(); // switch the back buffer to front glutSwapBuffers(); }