MCPcopy Create free account
hub / github.com/EasyRPG/Player / WriteToStream

Method WriteToStream

src/game_config.cpp:684–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682}
683
684void Game_Config::WriteToStream(Filesystem_Stream::OutputStream& os) const {
685 /** VIDEO SECTION */
686
687 os << "[Video]\n";
688 video.vsync.ToIni(os);
689 video.fullscreen.ToIni(os);
690 video.fps.ToIni(os);
691 video.fps_limit.ToIni(os);
692 video.window_zoom.ToIni(os);
693 video.scaling_mode.ToIni(os);
694 video.stretch.ToIni(os);
695 video.touch_ui.ToIni(os);
696 video.pause_when_focus_lost.ToIni(os);
697 video.game_resolution.ToIni(os);
698
699 // only preserve when toggling between window and fullscreen is supported
700 if (video.fullscreen.IsOptionVisible()) {
701 video.window_x.ToIni(os);
702 video.window_y.ToIni(os);
703 video.window_width.ToIni(os);
704 video.window_height.ToIni(os);
705 }
706 os << "\n";
707
708 /** AUDIO SECTION */
709 os << "[Audio]\n";
710
711 audio.music_volume.ToIni(os);
712 audio.sound_volume.ToIni(os);
713 audio.fluidsynth_midi.ToIni(os);
714 audio.wildmidi_midi.ToIni(os);
715 audio.native_midi.ToIni(os);
716 audio.soundfont.ToIni(os);
717
718 os << "\n";
719
720 /** INPUT SECTION */
721 os << "[Input]\n";
722
723 auto& mappings = Input::GetInputSource()->GetButtonMappings();
724 for (int i = 0; i < Input::BUTTON_COUNT; ++i) {
725 auto button = static_cast<Input::InputButton>(i);
726
727 auto name = Input::kInputButtonNames.tag(button);
728 os << name << "=";
729
730 std::stringstream ss;
731 bool first = true;
732 for (auto ki = mappings.LowerBound(button); ki != mappings.end() && ki->first == button;++ki) {
733 if (!first) {
734 os << ",";
735 }
736 first = false;
737
738 auto key = static_cast<Input::Keys::InputKey>(ki->second);
739 auto kname = Input::Keys::kInputKeyNames.tag(key);
740 os << kname;
741 }

Callers 1

SaveConfigMethod · 0.80

Calls 4

IsOptionVisibleMethod · 0.80
LowerBoundMethod · 0.80
ToIniMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected