Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Input.cpp:
- if(InputData->E && InputDataLastFrm->E)
- {
- // Do nothing
- }
- else if(InputData->E)
- {
- // Play a sound
- PlaySoundSFML();
- }
- else
- InputDataLastFrm->E = false;
- SFML_Audio.h:
- #pragma once
- #include <SFML/Audio.hpp>
- void PlaySoundSFML();
- extern sf::SoundBuffer Buffer;
- extern sf::Sound Sound;
- SFML_Audio.cpp:
- #include "SFML_Audio.h"
- sf::SoundBuffer Buffer;
- sf::Sound Sound(Buffer);
- void PlaySoundSFML()
- {
- // Load a sound buffer from a wav file
- if (!Buffer.LoadFromFile("Test3.wav"))
- return;
- // Play sound instance
- Sound.Play();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement