/** * @brief Opens the audio settings menu. */ void opt_menuAudio (void) { unsigned int wid; /* Create the window. */ wid = window_create( "Audio", -1, -1, AUDIO_WIDTH, AUDIO_HEIGHT ); /* Sound fader. */ if (!sound_disabled) { window_addFader( wid, 20, -40, 160, 20, "fadSound", 0., 1., sound_getVolume(), opt_setSFXLevel ); window_addText( wid, 200, -40, AUDIO_WIDTH-220, 20, 1, "txtSound", NULL, NULL, "Sound Volume" ); } else window_addText( wid, 200, -40, AUDIO_WIDTH-220, 20, 1, "txtSound", NULL, NULL, "Sound Disabled" ); /* Music fader. */ if (!music_disabled) { window_addFader( wid, 20, -80, 160, 20, "fadMusic", 0., 1., music_getVolume(), opt_setMusicLevel ); window_addText( wid, 200, -80, AUDIO_WIDTH-220, 20, 1, "txtMusic", NULL, NULL, "Music Volume" ); } else window_addText( wid, 200, -80, AUDIO_WIDTH-220, 20, 1, "txtMusic", NULL, NULL, "Music Disabled" ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", window_close ); }
/** * @brief Opens the audio settings menu. */ static void opt_audio( unsigned int wid ) { (void) wid; int i, j; int cw; int w, h, y, x, l; char buf[32], **s; const char *str; /* Get size. */ window_dimWindow( wid, &w, &h ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", opt_close ); window_addButton( wid, -20 - 1*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnApply", "Apply", opt_audioSave ); window_addButton( wid, -20 - 2*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnDefaults", "Defaults", opt_audioDefaults ); /* General options. */ cw = (w-60)/2; x = 20; y = -60; window_addText( wid, x+20, y, cw, 20, 0, "txtSGeneral", NULL, &cDConsole, "General" ); y -= 30; window_addCheckbox( wid, x, y, cw, 20, "chkNosound", "Disable all sound/music", NULL, conf.nosound ); y -= 30; str = "Backends"; l = gl_printWidthRaw( NULL, str ); window_addText( wid, x, y, l, 40, 0, "txtSBackends", NULL, NULL, str ); l += 10; i = 0; j = 0; s = malloc(sizeof(char*)*2); #if USE_OPENAL if (strcmp(conf.sound_backend,"openal")==0) j = i; s[i++] = strdup("openal"); #endif /* USE_OPENAL */ #if USE_SDLMIX if (strcmp(conf.sound_backend,"sdlmix")==0) j = i; s[i++] = strdup("sdlmix"); #endif /* USE_SDLMIX */ if (i==0) s[i++] = strdup("none"); window_addList( wid, x+l, y, cw-(x+l), 40, "lstSound", s, i, j, NULL ); y -= 50; /* OpenAL options. */ window_addText( wid, x+20, y, cw, 20, 0, "txtSOpenal", NULL, &cDConsole, "OpenAL" ); y -= 30; window_addCheckbox( wid, x, y, cw, 20, "chkEFX", "EFX (More CPU)", NULL, conf.al_efx ); y -= 20; /* Sound levels. */ x = 20 + cw + 20; y = -60; window_addText( wid, x+20, y, 100, 20, 0, "txtSVolume", NULL, &cDConsole, "Volume Levels" ); y -= 30; /* Sound fader. */ opt_audioLevelStr( buf, sizeof(buf), 0, sound_getVolume() ); window_addText( wid, x, y, cw, 20, 1, "txtSound", NULL, NULL, buf ); y -= 20; window_addFader( wid, x, y, cw, 20, "fadSound", 0., 1., sound_getVolume(), opt_setAudioLevel ); window_faderScrollDone( wid, "fadSound", opt_beep ); y -= 40; /* Music fader. */ opt_audioLevelStr( buf, sizeof(buf), 1, music_getVolume() ); window_addText( wid, x, y, cw, 20, 1, "txtMusic", NULL, NULL, buf ); y -= 20; window_addFader( wid, x, y, cw, 20, "fadMusic", 0., 1., music_getVolume(), opt_setAudioLevel ); y -= 20; /* Restart text. */ window_addText( wid, 20, 10, 3*(BUTTON_WIDTH + 20), 30, 0, "txtRestart", &gl_smallFont, &cBlack, NULL ); }
/** * @brief Opens the gameplay menu. */ static void opt_gameplay( unsigned int wid ) { (void) wid; char buf[PATH_MAX]; const char *path; int cw; int w, h, y, x, by, l; char *s; /* Get size. */ window_dimWindow( wid, &w, &h ); /* Close button */ window_addButton( wid, -20, 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnClose", "Close", opt_close ); window_addButton( wid, -20 - 1*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnApply", "Apply", opt_gameplaySave ); window_addButton( wid, -20 - 2*(BUTTON_WIDTH+20), 20, BUTTON_WIDTH, BUTTON_HEIGHT, "btnDefaults", "Defaults", opt_gameplayDefaults ); /* Information. */ cw = (w-40); x = 20; y = -60; window_addText( wid, x, y, cw, 20, 1, "txtVersion", NULL, NULL, naev_version(1) ); y -= 20; #ifdef GIT_COMMIT window_addText( wid, x, y, cw, 20, 1, "txtCommit", NULL, NULL, "Commit: "GIT_COMMIT ); #endif /* GIT_COMMIT */ y -= 20; path = ndata_getPath(); if (path == NULL) snprintf( buf, sizeof(buf), "not using ndata" ); else snprintf( buf, sizeof(buf), "ndata: %s", path); window_addText( wid, x, y, cw, 20, 1, "txtNdata", NULL, NULL, buf ); y -= 40; by = y; /* Compiletime stuff. */ cw = (w-60)/2; y = by; x = 20; window_addText( wid, x+20, y, cw, 20, 0, "txtCompile", NULL, &cDConsole, "Compilation Flags" ); y -= 30; window_addText( wid, x, y, cw, h+y-20, 0, "txtFlags", NULL, NULL, "" #ifdef DEBUGGING #ifdef DEBUG_PARANOID "Debug Paranoid\n" #else /* DEBUG_PARANOID */ "Debug\n" #endif /* DEBUG_PARANOID */ #endif /* DEBUGGING */ #if defined(LINUX) "Linux\n" #elif defined(FREEBSD) "FreeBSD\n" #elif defined(MACOSX) "Mac OS X\n" #elif defined(WIN32) "Windows\n" #else "Unknown OS\n" #endif #ifdef USE_OPENAL "With OpenAL\n" #endif /* USE_OPENAL */ #ifdef USE_SDLMIX "With SDL_mixer\n" #endif #ifdef HAVE_LUAJIT "Using Lua JIT\n" #endif #ifdef NDATA_DEF "ndata: "NDATA_DEF"\n" #endif /* NDATA_DEF */ #ifdef PREFSDIR_DEF "preference directory: "PREFSDIR_DEF"\n" #endif /* PREFSDIR_DEF */ ); /* Options. */ y = by; x += cw; /* Autonav abort. */ x = 20 + cw + 20; window_addText( wid, x+65, y, 150, 150, 0, "txtAAutonav", NULL, &cDConsole, "Abort Autonav At:" ); y -= 20; /* Autonav abort fader. */ opt_getAutonavAbortStr( buf, sizeof(buf) ); window_addText( wid, x, y, cw, 20, 1, "txtAutonav", NULL, NULL, buf ); y -= 20; window_addFader( wid, x, y, cw, 20, "fadAutonav", 0., 1., conf.autonav_abort, opt_setAutonavAbort ); y -= 40; window_addText( wid, x+20, y, cw, 20, 0, "txtSettings", NULL, &cDConsole, "Settings" ); y -= 25; window_addCheckbox( wid, x, y, cw, 20, "chkZoomManual", "Enable manual zoom control", NULL, conf.zoom_manual ); y -= 25; window_addCheckbox( wid, x, y, cw, 20, "chkAfterburn", "Enable double-tap afterburn", NULL, conf.afterburn_sens ); y -= 25; window_addCheckbox( wid, x, y, cw, 20, "chkMouseThrust", "Enable mouse-flying thrust control", NULL, conf.mouse_thrust ); y -= 25; window_addCheckbox( wid, x, y, cw, 20, "chkCompress", "Enable savegame compression", NULL, conf.save_compress ); y -= 30; s = "Visible Messages"; l = gl_printWidthRaw( NULL, s ); window_addText( wid, -100, y, l, 20, 1, "txtSMSG", NULL, &cBlack, s ); window_addInput( wid, -50, y, 40, 20, "inpMSG", 4, 1, NULL ); y -= 30; s = "Max Time Compression Factor"; l = gl_printWidthRaw( NULL, s ); window_addText( wid, -100, y, l, 20, 1, "txtTMax", NULL, &cBlack, s ); window_addInput( wid, -50, y, 40, 20, "inpTMax", 4, 1, NULL ); y -= 30; /* Restart text. */ window_addText( wid, 20, 10, 3*(BUTTON_WIDTH + 20), 30, 0, "txtRestart", &gl_smallFont, &cBlack, NULL ); /* Update. */ opt_gameplayUpdate( wid, NULL ); }