// All Setup For OpenGL Goes Here bool CGLLogoView::InitGL() { LoadTextures(); // what color to clear to in color buffer glClearColor(1.0, 1.0, 1.0, 1.0); // Cull backs of polygons glCullFace(GL_BACK); glFrontFace(GL_CCW); glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glEnable(GL_LINE_SMOOTH); glShadeModel(GL_SMOOTH); // Enable smooth shading glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Enable a single OpenGL light. glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular); glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT0, GL_SPECULAR, LightSpecular); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); quadric=gluNewQuadric(); gluQuadricNormals(quadric, GLU_SMOOTH); gluQuadricTexture(quadric, GL_TRUE); SetShadowMatrix(fShadowMatrix, LightPosition, Plane); CreateLogo(); CreateGLFont(); return true; }
BOOL CMyPreferences::OnInitDialog(CWindow, LPARAM) { char temp[16]; SendDlgItemMessage( IDC_INDEFINITE, BM_SETCHECK, cfg_indefinite ); SendDlgItemMessage( IDC_WRITE, BM_SETCHECK, cfg_write ); SendDlgItemMessage( IDC_WNSFE, BM_SETCHECK, cfg_write_nsfe ); SendDlgItemMessage( IDC_NSFEPL, BM_SETCHECK, cfg_nsfe_ignore_playlists ); SendDlgItemMessage( IDC_NSF4011, BM_SETCHECK, cfg_nsf_ignore_w4011 ); SendDlgItemMessage( IDC_ANTISURROUND, BM_SETCHECK, cfg_spc_anti_surround ); SendDlgItemMessage( IDC_GD3JAPANESE, BM_SETCHECK, cfg_vgm_gd3_prefers_japanese ); SendDlgItemMessage( IDC_EFFECTS, BM_SETCHECK, cfg_effects_enable ); print_time_crap( cfg_default_length, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DLENGTH, (char *)&temp ); print_time_crap( cfg_default_fade, (char *)&temp ); uSetDlgItemText( m_hWnd, IDC_DFADE, (char *)&temp ); CWindow w; w = GetDlgItem( IDC_SLIDER_BASS ); ::SendMessage( w, TBM_SETRANGE, 0, MAKELONG( 0, 255 ) ); ::SendMessage( w, TBM_SETPOS, 1, cfg_effects_bass ); w = GetDlgItem( IDC_SLIDER_TREBLE ); ::SendMessage( w, TBM_SETRANGE, 0, MAKELONG( 0, 255 ) ); ::SendMessage( w, TBM_SETPOS, 1, cfg_effects_treble ); w = GetDlgItem( IDC_SLIDER_ECHO_DEPTH ); ::SendMessage( w, TBM_SETRANGE, 0, MAKELONG( 0, 255 ) ); ::SendMessage( w, TBM_SETPOS, 1, cfg_effects_echo_depth ); int n,o; for(n=IDC_FORMAT_NSF,o=0;n<=IDC_FORMAT_SFM;n++,o++) { SendDlgItemMessage( n, BM_SETCHECK, cfg_format_enable & ( 1 << o ) ); } for(n=tabsize(srate_tab);n--;) { if (srate_tab[n] != cfg_sample_rate) { itoa(srate_tab[n], temp, 10); cfg_history_rate.add_item(temp); } } itoa( cfg_sample_rate, temp, 10 ); cfg_history_rate.add_item(temp); w = GetDlgItem( IDC_SAMPLERATE ); cfg_history_rate.setup_dropdown( w ); ::SendMessage( w, CB_SETCURSEL, 0, 0 ); w = GetDlgItem( IDC_VGMLOOPCOUNT ); uSendMessageText( w, CB_ADDSTRING, 0, "none" ); for (n = 1; n <= 10; n++) { itoa( n, temp, 10 ); uSendMessageText( w, CB_ADDSTRING, 0, temp ); } ::SendMessage( w, CB_SETCURSEL, cfg_vgm_loop_count, 0 ); enable_vgm_loop_count( !cfg_indefinite ); w = GetDlgItem( IDC_INTERPOLATION ); uSendMessageText( w, CB_ADDSTRING, 0, "None" ); uSendMessageText( w, CB_ADDSTRING, 0, "Linear" ); uSendMessageText( w, CB_ADDSTRING, 0, "Gaussian" ); uSendMessageText( w, CB_ADDSTRING, 0, "Cubic" ); uSendMessageText( w, CB_ADDSTRING, 0, "Sinc" ); ::SendMessage( w, CB_SETCURSEL, cfg_spc_interpolation + 2, 0 ); union { RECT r; POINT p [2]; }; w = GetDlgItem( IDC_GROUPBOX ); w.GetClientRect( &r ); w.MapWindowPoints( m_hWnd, &p [1], 1 ); CreateLogo( m_hWnd, p [1].x + 2, p [1].y - 181 ); return FALSE; }
/* * Application entry point. */ int main(void) { /* * System initializations. * - HAL initialization, this also initializes the configured device drivers * and performs the board-specific initializations. * - Kernel initialization, the main() function becomes a thread and the * RTOS is active. */ halInit(); chSysInit(); ADC2status = 0; //write_to_backup_sram(0, 0, 0); startBlinker(); /* initialize and clear the display */ gfxInit(); ginputGetMouse(0); //ginputSetMouseCalibrationRoutines(0, mysave, myload, FALSE); //ginputGetMouse(0); // new ugfx do not need this gwinAttachMouse(0); geventListenerInit(&gl); gwinAttachListener(&gl); //geventAttachSource(&gl, mouse, GLISTEN_MOUSEDOWNMOVES|GLISTEN_MOUSEMETA); //mouse = ginputGetMouse(0); //get screen size width = gdispGetWidth(); height = gdispGetHeight(); swidth = gdispGetWidth(); sheight = gdispGetHeight(); font = gdispOpenFont("UI2"); //startBlinker(); myADCinit(); ICUinit(); /* * Activates the serial driver 1 using the driver default configuration. * PA2(TX) and PA3(RX) are routed to USART2. */ sdStart(&SD2, NULL); palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7)); palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7)); chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL); //mouse = ginputGetMouse(0); font = gdispOpenFont("UI2"); gwinSetDefaultFont(font); gwinSetDefaultBgColor(Black); gwinSetDefaultColor(White); bHeight = gdispGetFontMetric(font, fontHeight)+2; #if BOOTSCREEN bootScreen(); #endif #ifdef LOGO gdispClear(Black); CreateLogo(); #endif // create main screen createWidgets(); chprintf( (BaseSequentialStream *)&SD2, "Main loop\r\n", NULL ); while (TRUE) { //get an event pe = geventEventWait(&gl, TIME_INFINITE); switch(pe->type) { case GEVENT_TOUCH: { pem = (GEventMouse *)pe; if ((pem->type & GMETA_MOUSE_CLICK)) { //gwinSetColor(ghc, Yellow); chprintf((BaseSequentialStream *)&SD2, "\r\n-touch-click"); } } case GEVENT_GWIN_BUTTON: if (((GEventGWinButton*)pe)->button == ghConsole) { gwinSetText(ghStatus2, "Console", TRUE); chprintf( (BaseSequentialStream *)&SD2, "\r\nConsole button", NULL ); }; break; case GEVENT_GWIN_SLIDER: if (((GEventGWinSlider*)pe)->slider == ghBrightness) { gdispSetBacklight(((GEventGWinSlider *)pe)->position); chprintf((BaseSequentialStream *)&SD2,"Slider %s = %d\r\n", gwinGetText(((GEventGWinSlider *)pe)->slider), ((GEventGWinSlider *)pe)->position); } break; default: break ; } } }