MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / OptionsAudioState

Method OptionsAudioState

src/Menu/OptionsAudioState.cpp:45–209  ·  view source on GitHub ↗

* Initializes all the elements in the Audio Options screen. * @param game Pointer to the core game. * @param origin Game section that originated this state. */

Source from the content-addressed store, hash-verified

43 * @param origin Game section that originated this state.
44 */
45OptionsAudioState::OptionsAudioState(Game *game, OptionsOrigin origin) : OptionsBaseState(game, origin)
46{
47 setCategory(_btnAudio);
48
49 // Create objects
50 _txtMusicVolume = new Text(114, 9, 94, 8);
51 _slrMusicVolume = new Slider(104, 16, 94, 18);
52
53 _txtSoundVolume = new Text(114, 9, 206, 8);
54 _slrSoundVolume = new Slider(104, 16, 206, 18);
55
56 _txtUiVolume = new Text(114, 9, 94, 40);
57 _slrUiVolume = new Slider(104, 16, 94, 50);
58
59 _txtSampleRate = new Text(114, 9, 206, 40);
60 _cbxSampleRate = new ComboBox(this, 104, 16, 206, 50);
61
62 _txtMusicFormat = new Text(114, 9, 94, 72);
63 _cbxMusicFormat = new ComboBox(this, 104, 16, 94, 82);
64 _txtCurrentMusic = new Text(114, 9, 94, 100);
65
66 _txtSoundFormat = new Text(114, 9, 206, 72);
67 _cbxSoundFormat = new ComboBox(this, 104, 16, 206, 82);
68 _txtCurrentSound = new Text(114, 9, 206, 100);
69
70 add(_txtMusicVolume);
71 add(_slrMusicVolume);
72
73 add(_txtSoundVolume);
74 add(_slrSoundVolume);
75
76 add(_txtUiVolume);
77 add(_slrUiVolume);
78
79 add(_txtSampleRate);
80
81 add(_txtMusicFormat);
82 add(_txtCurrentMusic);
83 add(_txtSoundFormat);
84 add(_txtCurrentSound);
85
86 add(_cbxMusicFormat);
87 add(_cbxSoundFormat);
88
89 add(_cbxSampleRate);
90
91 centerAllSurfaces();
92
93 // Set up objects
94 _txtMusicVolume->setColor(Palette::blockOffset(8)+10);
95 _txtMusicVolume->setText(tr("STR_MUSIC_VOLUME"));
96
97 _slrMusicVolume->setColor(Palette::blockOffset(15)-1);
98 _slrMusicVolume->setRange(0, SDL_MIX_MAXVOLUME);
99 _slrMusicVolume->setValue(Options::musicVolume);
100 _slrMusicVolume->onChange((ActionHandler)&OptionsAudioState::slrMusicVolumeChange);
101 _slrMusicVolume->setTooltip("STR_MUSIC_VOLUME_DESC");
102 _slrMusicVolume->onMouseIn((ActionHandler)&OptionsAudioState::txtTooltipIn);

Callers

nothing calls this directly

Calls 13

setTooltipMethod · 0.80
onMouseInMethod · 0.80
onMouseOutMethod · 0.80
onMouseReleaseMethod · 0.80
setSelectedMethod · 0.80
setOptionsMethod · 0.80
argMethod · 0.60
setColorMethod · 0.45
setTextMethod · 0.45
setRangeMethod · 0.45
setValueMethod · 0.45
onChangeMethod · 0.45

Tested by

no test coverage detected