MCPcopy Create free account
hub / github.com/SFML/SFML / Processing

Method Processing

examples/sound_effects/SoundEffects.cpp:669–692  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

667
668protected:
669 explicit Processing(std::string name) :
670 Effect(std::move(name)),
671 m_enabledText(getFont(), "Processing: Enabled"),
672 m_instructions(getFont(), "Press Space to enable/disable processing")
673 {
674 m_listener.setPosition({(windowWidth - 20.f) / 2.f, (windowHeight - 20.f) / 2.f});
675 m_listener.setFillColor(sf::Color::Red);
676
677 m_enabledText.setPosition({windowWidth / 2.f - 120.f, windowHeight * 3.f / 4.f - 50.f});
678 m_instructions.setPosition({windowWidth / 2.f - 250.f, windowHeight * 3.f / 4.f});
679
680 // Load the music file
681 if (!m_music.openFromFile(resourcesDir() / "doodle_pop.ogg"))
682 {
683 std::cerr << "Failed to load " << (resourcesDir() / "doodle_pop.ogg").string() << std::endl;
684 std::abort();
685 }
686
687 // Set the music to loop
688 m_music.setLooping(true);
689
690 // Set attenuation to a nice value
691 m_music.setAttenuation(0.0f);
692 }
693
694 sf::Music& getMusic()
695 {

Callers

nothing calls this directly

Calls 6

setAttenuationMethod · 0.80
resourcesDirFunction · 0.70
setPositionMethod · 0.45
setFillColorMethod · 0.45
openFromFileMethod · 0.45
setLoopingMethod · 0.45

Tested by

no test coverage detected