Skip to content

Commit

Permalink
try fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
onon1101 committed Apr 25, 2024
1 parent 36cf722 commit d9a4e21
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 724 deletions.
17 changes: 11 additions & 6 deletions include/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
#include "pch.hpp" // IWYU pragma: export

#include "Dungeon/Map.h"
#include "Game/Camera.h"
#include "Music/Music.h"
#include "Player/Player.h"
#include "Settings/Background.hpp"
#include "Player.h"
#include "Player/Equipment/Shovel.h"
#include "Player/Items/Coin.h"
#include "Player/Items/Diamond.h"
#include "Player/Items/Heart.h"
#include "Player/Items/Tools.h"
#include "SpriteSheet.hpp"
#include "Util/Text.hpp"
#include "pch.hpp" // IWYU pragma: export

class App {
public:
Expand Down Expand Up @@ -37,8 +42,8 @@ class App {
bool m_IsMainMenu = true;

// music
std::shared_ptr<Music::Player> m_MusicSystem =
std::make_shared<Music::Player>();
// std::shared_ptr<Music::Player> m_MusicSystem =
// std::make_shared<Music::Player>();

// settings
glm::vec2 m_AniPlayerDestination = {0.0f, 0.0f};
Expand Down
62 changes: 0 additions & 62 deletions include/Music/BeatHeart.h

This file was deleted.

84 changes: 0 additions & 84 deletions include/Music/Music.h

This file was deleted.

40 changes: 40 additions & 0 deletions include/Music/Player.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef MUSIC_PLAYER_H
#define MUSIC_PLAYER_H

#include <string>

#include "soloud.h"
#include "soloud_speech.h"
#include "soloud_thread.h"
#include "soloud_wav.h"

namespace Music {
class Player {
public:
static void Init();

static void PlayMusic(const std::string& path, bool loop = false);
static void PlayMusic(
const std::string& path,
bool loop,
float volume,
float speed
);

static void StopMusic();

static void Shutdown();

static void SetVolume(float volume);

static void SetSpeed(float speed);

private:
static SoLoud::Soloud m_MusicSystem;
static std::shared_ptr<SoLoud::Wav> m_Wav;
static SoLoud::Speech m_Speech;
static SoLoud::handle m_MusicHandle;
};
} // namespace Music

#endif // MUSIC_PLAYER_H
54 changes: 0 additions & 54 deletions include/Music/RhythmIndicator.h

This file was deleted.

72 changes: 0 additions & 72 deletions include/Music/Tempo.h
Original file line number Diff line number Diff line change
@@ -1,72 +0,0 @@
//
// Created by adven on 2024/3/27.
//

#ifndef FUCK_PTSD_TEMPO_H
#define FUCK_PTSD_TEMPO_H

#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

#include "Util/Logger.hpp"

namespace Music {
class Tempo final {
public:
explicit Tempo();
~Tempo();

// must read one line in file, it not be '\n'
void readTempoFile(const std::string& txtFilePath);

bool canBeClick();

void keyBoardClick();

std::size_t getTempo();
std::size_t getTempoIndex() const;

void setMusicSpeed(float speed) { m_MusicSpeed = speed; };
void setShowBeat(bool state) { isShowHeartBeat = state; };
void setRange(std::size_t range) { m_range = range; };
void setOffset(int16_t offset) { m_offset = offset; };

void setMusicCurrentTime(std::size_t time) {
m_duringTime = time + m_offset;
};
void Update();

std::vector<std::size_t> GetTempoTriggerList();

protected:
void UpdateTime();
void UpdateTempoIndex();

private:
std::vector<std::size_t> txtToVector(
const std::string& line,
const char splitChar
);

float m_MusicSpeed = 1.0f;

bool isShowHeartBeat = false;
bool m_isWrongTimeClick = false;
std::size_t m_punishTimes = 0;

std::size_t m_duringTime = 0;
std::size_t m_range = 500;
int16_t m_offset = 0; // (ms)

std::size_t m_currentTempoTime = 0;
std::size_t m_tempoIndex = 0;
std::size_t m_currentTempoIndex = 0;
std::size_t m_tempoListLength = 0;
std::vector<std::size_t> m_tempoList;
};
} // namespace Music

#endif // FUCK_PTSD_TEMPO_H
Loading

0 comments on commit d9a4e21

Please sign in to comment.