-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:X-R-G-B/R-Bus into feature/RB-54-col…
…lision-system
- Loading branch information
Showing
24 changed files
with
1,674 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/bin/pwsh | ||
# Install deps | ||
|
||
winget install --accept-package-agreements --accept-source-agreements LLVM -e | ||
winget install --accept-package-agreements --accept-source-agreements CMake -e | ||
winget list -e LLVM | ||
if ($LASTEXITCODE -ne 0) { | ||
winget install --accept-package-agreements --accept-source-agreements LLVM -e | ||
} | ||
|
||
winget list -e CMake | ||
if ($LASTEXITCODE -ne 0) { | ||
winget install --accept-package-agreements --accept-source-agreements CMake -e | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ target_sources( | |
) | ||
|
||
add_subdirectory(Systems) | ||
add_subdirectory(Raylib) | ||
add_subdirectory(EventManager) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
/* | ||
** EPITECH PROJECT, 2023 | ||
** R-Bus | ||
** File description: | ||
** Audio | ||
*/ | ||
|
||
#include "Audio.hpp" | ||
|
||
namespace Raylib { | ||
|
||
// Audio device management functions | ||
|
||
void initAudioDevice() | ||
{ | ||
InitAudioDevice(); | ||
} | ||
|
||
void closeAudioDevice() | ||
{ | ||
CloseAudioDevice(); | ||
} | ||
|
||
bool isAudioDeviceReady() | ||
{ | ||
return IsAudioDeviceReady(); | ||
} | ||
|
||
void setMasterVolume(float volume) | ||
{ | ||
SetMasterVolume(volume); | ||
} | ||
|
||
// Sounds | ||
Sound::Sound(const std::string& fileName, float volume) | ||
: _sound(LoadSound(fileName.c_str())), | ||
_path(fileName) | ||
{ | ||
SetSoundVolume(_sound, volume); | ||
} | ||
|
||
void Sound::unload() | ||
{ | ||
UnloadSound(_sound); | ||
} | ||
|
||
void Sound::play() const | ||
{ | ||
PlaySound(_sound); | ||
} | ||
|
||
void Sound::stop() const | ||
{ | ||
StopSound(_sound); | ||
} | ||
|
||
void Sound::pause() const | ||
{ | ||
PauseSound(_sound); | ||
} | ||
|
||
void Sound::resume() const | ||
{ | ||
ResumeSound(_sound); | ||
} | ||
|
||
bool Sound::isPlaying() const | ||
{ | ||
return IsSoundPlaying(_sound); | ||
} | ||
|
||
void Sound::setVolume(float volume) const | ||
{ | ||
SetSoundVolume(_sound, volume); | ||
} | ||
|
||
void Sound::setPitch(float pitch) const | ||
{ | ||
SetSoundPitch(_sound, pitch); | ||
} | ||
|
||
void Sound::setPan(float pan) const | ||
{ | ||
SetSoundPitch(_sound, pan); | ||
} | ||
|
||
bool Sound::NeedToPlay() const | ||
{ | ||
return _needToPlay; | ||
} | ||
|
||
void Sound::setNeedToPlay(bool needToPlay) | ||
{ | ||
_needToPlay = needToPlay; | ||
} | ||
|
||
std::string Sound::getPath() const | ||
{ | ||
return _path; | ||
} | ||
|
||
// Music | ||
|
||
Music::Music(const std::string& fileName, float volume) | ||
: _music(LoadMusicStream(fileName.c_str())), | ||
_path(fileName) | ||
{ | ||
SetMusicVolume(_music, volume); | ||
} | ||
|
||
void Music::unload() | ||
{ | ||
UnloadMusicStream(_music); | ||
} | ||
|
||
bool Music::isReady() const | ||
{ | ||
return IsMusicStreamPlaying(_music); | ||
} | ||
|
||
void Music::play() const | ||
{ | ||
PlayMusicStream(_music); | ||
} | ||
|
||
bool Music::isPlaying() const | ||
{ | ||
return IsMusicStreamPlaying(_music); | ||
} | ||
|
||
void Music::update() const | ||
{ | ||
UpdateMusicStream(_music); | ||
} | ||
|
||
void Music::stop() const | ||
{ | ||
StopMusicStream(_music); | ||
} | ||
|
||
void Music::pause() const | ||
{ | ||
PauseMusicStream(_music); | ||
} | ||
|
||
void Music::resume() const | ||
{ | ||
ResumeMusicStream(_music); | ||
} | ||
|
||
void Music::setVolume(float volume) const | ||
{ | ||
SetMusicVolume(_music, volume); | ||
} | ||
|
||
void Music::setPitch(float pitch) const | ||
{ | ||
SetMusicPitch(_music, pitch); | ||
} | ||
|
||
void Music::setPan(float pan) const | ||
{ | ||
SetMusicPitch(_music, pan); | ||
} | ||
|
||
float Music::getTimeLength() const | ||
{ | ||
return GetMusicTimeLength(_music); | ||
} | ||
|
||
float Music::getTimePlayed() const | ||
{ | ||
return GetMusicTimePlayed(_music); | ||
} | ||
|
||
bool Music::NeedToPlay() const | ||
{ | ||
return _needToPlay; | ||
} | ||
|
||
void Music::setNeedToPlay(bool needToPlay) | ||
{ | ||
_needToPlay = needToPlay; | ||
} | ||
|
||
std::string Music::getPath() const | ||
{ | ||
return _path; | ||
} | ||
} // namespace Raylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
** EPITECH PROJECT, 2023 | ||
** R-Bus | ||
** File description: | ||
** Audio | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include "raylib.h" | ||
|
||
namespace Raylib { | ||
// Audio device management functions | ||
void initAudioDevice(); | ||
void closeAudioDevice(); | ||
bool isAudioDeviceReady(); | ||
void setMasterVolume(float volume); | ||
|
||
// Sounds | ||
class Sound { | ||
public: | ||
Sound(const std::string& fileName, float volume = 0.5f); | ||
void unload(); | ||
void play() const; | ||
void stop() const; | ||
void pause() const; | ||
void resume() const; | ||
bool isPlaying() const; | ||
void setVolume(float volume) const; | ||
void setPitch(float pitch) const; | ||
void setPan(float pan) const; | ||
bool NeedToPlay() const; | ||
void setNeedToPlay(bool needToPlay); | ||
std::string getPath() const; | ||
|
||
private: | ||
::Sound _sound; | ||
bool _needToPlay {false}; | ||
std::string _path; | ||
}; | ||
|
||
class Music { | ||
public: | ||
Music(const std::string& fileName, float volume = 0.5f); | ||
void unload(); | ||
bool isReady() const; | ||
void play() const; | ||
bool isPlaying() const; | ||
void update() const; | ||
void stop() const; | ||
void pause() const; | ||
void resume() const; | ||
void setVolume(float volume) const; | ||
void setPitch(float pitch) const; | ||
void setPan(float pan) const; | ||
float getTimeLength() const; | ||
float getTimePlayed() const; | ||
bool NeedToPlay() const; | ||
void setNeedToPlay(bool needToPlay); | ||
std::string getPath() const; | ||
|
||
private: | ||
::Music _music; | ||
bool _needToPlay {false}; | ||
std::string _path; | ||
}; | ||
} // namespace Raylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
target_include_directories( | ||
${PROJECT_NAME_CLIENT} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
target_sources( | ||
${PROJECT_NAME_CLIENT} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR}/Audio.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
target_include_directories( | ||
${PROJECT_NAME_CLIENT} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
add_subdirectory(Geometry) | ||
add_subdirectory(Graphics) | ||
add_subdirectory(Audio) | ||
add_subdirectory(Events) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
target_include_directories( | ||
${PROJECT_NAME_CLIENT} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) |
Oops, something went wrong.