Browse Source

hey, music

opengl-renderer-broken
Martin Dørum 4 years ago
parent
commit
bc0f62c44d
4 changed files with 1237 additions and 1 deletions
  1. 1
    1
      CMakeLists.txt
  2. 1223
    0
      assets-src/music/happy-1.json
  3. BIN
      assets/music/happy-1.wav
  4. 13
    0
      src/main.cc

+ 1
- 1
CMakeLists.txt View File

@@ -22,5 +22,5 @@ add_subdirectory(libswan)
add_subdirectory(core.mod)

add_executable(swan src/main.cc)
target_link_libraries(swan libswan sfml-graphics sfml-system sfml-window dl)
target_link_libraries(swan libswan sfml-graphics sfml-system sfml-window sfml-audio dl)
file(COPY assets DESTINATION .)

+ 1223
- 0
assets-src/music/happy-1.json
File diff suppressed because it is too large
View File


BIN
assets/music/happy-1.wav View File


+ 13
- 0
src/main.cc View File

@@ -9,6 +9,7 @@
#include <swan/Timer.h>

#include <SFML/System/Clock.hpp>
#include <SFML/Audio.hpp>

using namespace Swan;

@@ -19,11 +20,23 @@ int main() {
abort();
}

// Cretate window
sf::RenderWindow window(sf::VideoMode(800, 600), "Project: SWAN");
window.setVerticalSyncEnabled(true);
window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
Win win(&window);

// Create music
sf::SoundBuffer musicbuf;
sf::Sound music;
if (musicbuf.loadFromFile("assets/music/happy-1.wav")) {
music.setBuffer(musicbuf);
music.setLoop(true);
music.play();
} else {
fprintf(stderr, "Failed to load music! Am very sad.\n");
}

Game::initGlobal();

Game game(win);

Loading…
Cancel
Save