SFML community forums
Help => Audio => Topic started by: ngocdung93 on December 02, 2013, 03:38:29 pm
-
Hi everybody. I am a newbie and i have a homework about coding a simple audio player. I can write a program that show a plain window when you open it and play the audio but could you show me how to insert a picture into that window and have click function (click to play-click to pause, something like that).
This is my code
sf::RenderWindow window(sf::VideoMode(sf::VideoMode::getDesktopMode()), "SFML");
sf::SoundBuffer buffer;
if (!buffer.loadFromFile("Music.wav"))
return -1;
sf::Sound sound;
sound.setBuffer(buffer);
sound.play();
while(window.isOpen())
{
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
}
}
-
We're not really here to write your homework...
By looking at the tutorials, documentation and examples that get shipped with SFML, you should be able to get something up and running in no time. ;)
-
thank you anyway. i am trying my best,hope to figure it out soon.