Skip to content

Commit

Permalink
Merge pull request #40 from Bollos00/39-sound-effects
Browse files Browse the repository at this point in the history
sound effects in the game
  • Loading branch information
Bollos00 authored Feb 7, 2022
2 parents b778703 + d1dbcba commit b789b9b
Show file tree
Hide file tree
Showing 38 changed files with 428 additions and 171 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:
run: "sudo apt-get update"

- name: "Install dependencies"
run: "sudo apt-get install build-essential qt5-default cmake libqt5svg5-dev"
run: "sudo apt-get install build-essential qt5-default cmake libqt5svg5-dev qtmultimedia5-dev"

- name: "Create build directory and run CMake"
run: "mkdir build && cd build && cmake .."

- name: "Build"
run: "cd build && make"

Expand All @@ -51,19 +51,19 @@ jobs:
- uses: actions/checkout@v2

- name: "Install dependencies"
run: "pacman -Syu --noconfirm base-devel qt6-base qt6-svg cmake"
run: "pacman -Syu --noconfirm base-devel qt6-base qt6-svg qt6-multimedia cmake"

- name: "Create build directory and run CMake"
run: "mkdir build && cd build && cmake -DUSE_QT6='YES' .."

- name: "Build"
run: "cd build && make"

build-windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2

- name: "Install Qt"
uses: jurplel/[email protected]
with:
Expand All @@ -78,7 +78,6 @@ jobs:

- name: "Create build directory and run CMake"
run: "mkdir build && cd build && cmake .."

- name: "Build"
run: "cd build && cmake --build . --config Release"

11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#############################################################################
# LibreMines #
# Copyright (C) 2020-2021 Bruno Bollos Correa # #
# Copyright (C) 2020-2022 Bruno Bollos Correa # #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
Expand All @@ -18,7 +18,7 @@
message(STATUS "Using CMake version ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 3.1.0)
project(libremines
VERSION "1.8.0"
VERSION "1.9.0"
DESCRIPTION " A Free/Libre and Open Source Software Qt based Minesweeper game available for GNU/Linux, FreeBSD and Windows systems. "
HOMEPAGE_URL "https://github.com/Bollos00/LibreMines"
LANGUAGES "CXX"
Expand All @@ -29,6 +29,7 @@ if(USE_QT6)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Svg)
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
# If the option UPDATE_TRANSLATIONS is passed, the Qt5LinguistTools is needed
# to generate the QM Files
if(UPDATE_TRANSLATIONS)
Expand All @@ -38,6 +39,7 @@ else()
find_package(Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt5 REQUIRED COMPONENTS Core)
find_package(Qt5 REQUIRED COMPONENTS Svg)
find_package(Qt5 REQUIRED COMPONENTS Multimedia)
if(UPDATE_TRANSLATIONS)
find_package(Qt5 REQUIRED COMPONENTS LinguistTools)
endif()
Expand Down Expand Up @@ -114,6 +116,8 @@ add_executable(${PROJECT_NAME} WIN32
src/qlabel_adapted.h
src/qpushbutton_adapted.cpp
src/qpushbutton_adapted.h
src/soundeffects.cpp
src/soundeffects.h
share/application_stylesheets/breeze/breeze.qrc
share/application_stylesheets/qdarkstyle/dark/qdarkstyle_dark.qrc
share/application_stylesheets/qdarkstyle/light/qdarkstyle_light.qrc
Expand All @@ -122,6 +126,7 @@ add_executable(${PROJECT_NAME} WIN32
share/icons.qrc
share/icons.rc
share/minefield_themes.qrc
share/sound_effects.qrc
)

include_directories(src)
Expand All @@ -147,10 +152,12 @@ if(USE_QT6)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Svg)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Multimedia)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Svg)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Multimedia)
endif()

# Set the install settings for Unix environments
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

LibreMines
Copyright (C) 2020-2021 Bruno Bollos Correa
Copyright (C) 2020-2022 Bruno Bollos Correa

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

LibreMines Copyright (C) 2020-2021 Bruno Bollos Correa
LibreMines Copyright (C) 2020-2022 Bruno Bollos Correa
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ Note: Qt6 is also supported

On Arch Linux and derivatives systems, the dependencies can be installed with `pacman`:
```sh
sudo pacman -S base-devel qt5-base qt5-svg cmake
sudo pacman -S base-devel qt5-base qt5-svg qt5-multimedia cmake
```

For Ubuntu, you can install the dependencies with the following command:
```sh
sudo apt-get install build-essential qt5-default cmake libqt5svg5-dev git
sudo apt-get install build-essential qt5-default cmake libqt5svg5-dev qtmultimedia5-dev git
```

On Fedora, install the dependencies with:
```sh
sudo dnf install qt5-qtbase-devel qt5-qtsvg-devel cmake git
sudo dnf install qt5-qtbase-devel qt5-qtsvg-devel cmake qt5-qtmultimedia-devel git
```

On FreeBSD systems, install the packages [qt5-core](https://www.freshports.org/devel/qt5-core), [qt5-widgets](https://www.freshports.org/x11-toolkits/qt5-widgets/), [qt5-svg](https://www.freshports.org/graphics/qt5-svg/), [qt5-buildtools](https://www.freshports.org/devel/qt5-buildtools/), [qt5-qmake](https://www.freshports.org/devel/qt5-qmake/) [git](https://www.freshports.org/devel/git/) and [cmake](https://www.freshports.org/devel/cmake/).
On FreeBSD systems, install the packages [qt5-core](https://www.freshports.org/devel/qt5-core), [qt5-widgets](https://www.freshports.org/x11-toolkits/qt5-widgets/), [qt5-svg](https://www.freshports.org/graphics/qt5-svg/), [qt5-buildtools](https://www.freshports.org/devel/qt5-buildtools/), [qt5-qmake](https://www.freshports.org/devel/qt5-qmake/), [qt5-multimedia](https://www.freshports.org/multimedia/qt5-multimedia/), [git](https://www.freshports.org/devel/git/) and [cmake](https://www.freshports.org/devel/cmake/).

```sh
su -
Expand Down
2 changes: 1 addition & 1 deletion include/libreminesconfig.h.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020-2021 Bruno Bollos Correa *
* Copyright (C) 2020-2022 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down
10 changes: 10 additions & 0 deletions share/sound_effects.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/">
<file>sound_effects/clock_tick.wav</file>
<file>sound_effects/flag_cell.wav</file>
<file>sound_effects/game_lost.wav</file>
<file>sound_effects/game_won.wav</file>
<file>sound_effects/release_cell.wav</file>
<file>sound_effects/move.wav</file>
</qresource>
</RCC>
13 changes: 13 additions & 0 deletions share/sound_effects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Credits

* Clock tick: https://freesound.org/people/andersmmg/sounds/511492/

* Flag cell: https://freesound.org/people/ironcross32/sounds/582695/

* Game lost: https://freesound.org/people/Nbs%20Dark/sounds/94185/

* Game won: https://freesound.org/people/Mativve/sounds/391539/

* Release cell: https://freesound.org/people/Greencouch/sounds/124897/

* Move: https://freesound.org/people/AbdrTar/sounds/558117/
Binary file added share/sound_effects/clock_tick.wav
Binary file not shown.
Binary file added share/sound_effects/flag_cell.wav
Binary file not shown.
Binary file added share/sound_effects/game_lost.wav
Binary file not shown.
Binary file added share/sound_effects/game_won.wav
Binary file not shown.
Binary file added share/sound_effects/move.wav
Binary file not shown.
Binary file added share/sound_effects/release_cell.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion src/common.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020-2021 Bruno Bollos Correa *
* Copyright (C) 2020-2022 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020-2021 Bruno Bollos Correa *
* Copyright (C) 2020-2022 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down
2 changes: 1 addition & 1 deletion src/libreminesgameengine.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020-2021 Bruno Bollos Correa *
* Copyright (C) 2020-2022 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down
2 changes: 1 addition & 1 deletion src/libreminesgameengine.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020-2021 Bruno Bollos Correa *
* Copyright (C) 2020-2022 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down
28 changes: 25 additions & 3 deletions src/libreminesgui.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020-2021 Bruno Bollos Correa *
* Copyright (C) 2020-2022 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down Expand Up @@ -59,7 +59,8 @@ LibreMinesGui::LibreMinesGui(QWidget *parent, const int thatWidth, const int tha
cellLength( 0 ),
difficult( NONE ),
preferences( new LibreMinesPreferencesDialog(this) ),
dirAppData( QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) )
dirAppData( QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) ),
sound( new SoundEffects() )
{
this->resize(800, 600);

Expand Down Expand Up @@ -1185,6 +1186,9 @@ void LibreMinesGui::SLOT_showCell(const uchar _X, const uchar _Y)
vKeyboardControllUnsetCurrentCell();
vKeyboardControllerSetCurrentCell(controller.currentX, controller.currentY);
}


Q_EMIT(sound->SIGNAL_releaseCell());
}

void LibreMinesGui::SLOT_endGameScore(LibreMinesScore score,
Expand Down Expand Up @@ -1329,6 +1333,8 @@ void LibreMinesGui::SLOT_endGameScore(LibreMinesScore score,
void LibreMinesGui::SLOT_currentTime(const ushort time)
{
labelTimerInGame->setNum(time);

// Q_EMIT(sound->SIGNAL_clockTick());
}

void LibreMinesGui::SLOT_minesLeft(const ushort minesLeft)
Expand All @@ -1350,6 +1356,8 @@ void LibreMinesGui::SLOT_flagCell(const uchar _X, const uchar _Y)
{
vKeyboardControllerSetCurrentCell(controller.currentX, controller.currentY);
}

Q_EMIT(sound->SIGNAL_flagCell());
}

void LibreMinesGui::SLOT_unflagCell(const uchar _X, const uchar _Y)
Expand All @@ -1366,6 +1374,8 @@ void LibreMinesGui::SLOT_unflagCell(const uchar _X, const uchar _Y)
{
vKeyboardControllerSetCurrentCell(controller.currentX, controller.currentY);
}

Q_EMIT(sound->SIGNAL_flagCell());
}

void LibreMinesGui::SLOT_remakeGame()
Expand Down Expand Up @@ -1411,6 +1421,8 @@ void LibreMinesGui::SLOT_gameWon()
}

labelFaceReactionInGame->setPixmap(*pmGrinningFace);

Q_EMIT(sound->SIGNAL_gameWon());
}

void LibreMinesGui::SLOT_gameLost(const uchar _X, const uchar _Y)
Expand Down Expand Up @@ -1475,6 +1487,7 @@ void LibreMinesGui::SLOT_gameLost(const uchar _X, const uchar _Y)
}

labelFaceReactionInGame->setPixmap(*pmDizzyFace);
Q_EMIT(sound->SIGNAL_gameLost());
}

void LibreMinesGui::SLOT_optionChanged(const QString &name, const QString &value)
Expand Down Expand Up @@ -1513,7 +1526,7 @@ void LibreMinesGui::SLOT_showAboutDialog()
{
QString text =
"LibreMines " + QString(LIBREMINES_PROJECT_VERSION) + "\n" +
tr("Copyright (C) 2020-2021 Bruno Bollos Correa\n"
tr("Copyright (C) 2020-2022 Bruno Bollos Correa\n"
"\n"
"This program is free software: you can redistribute it and/or modify"
" it under the terms of the GNU General Public License as published by"
Expand Down Expand Up @@ -1722,6 +1735,8 @@ void LibreMinesGui::vKeyboardControllerMoveLeft()
}

vKeyboardControllerSetCurrentCell(destX, controller.currentY);

Q_EMIT(sound->SIGNAL_keyboardControllerMove());
}

void LibreMinesGui::vKeyboardControllerMoveRight()
Expand Down Expand Up @@ -1755,6 +1770,7 @@ void LibreMinesGui::vKeyboardControllerMoveRight()

vKeyboardControllerSetCurrentCell(destX, controller.currentY);

Q_EMIT(sound->SIGNAL_keyboardControllerMove());
}

void LibreMinesGui::vKeyboardControllerMoveDown()
Expand Down Expand Up @@ -1788,6 +1804,7 @@ void LibreMinesGui::vKeyboardControllerMoveDown()

vKeyboardControllerSetCurrentCell(controller.currentX, destY);

Q_EMIT(sound->SIGNAL_keyboardControllerMove());
}

void LibreMinesGui::vKeyboardControllerMoveUp()
Expand Down Expand Up @@ -1820,6 +1837,8 @@ void LibreMinesGui::vKeyboardControllerMoveUp()
}

vKeyboardControllerSetCurrentCell(controller.currentX, destY);

Q_EMIT(sound->SIGNAL_keyboardControllerMove());
}

void LibreMinesGui::vKeyboardControllerCenterCurrentCell()
Expand Down Expand Up @@ -1861,4 +1880,7 @@ void LibreMinesGui::vUpdatePreferences()
preferences->setOptionUsername(qgetenv("USER"));
#endif
}

sound->setVolume(preferences->optionSoundVolume());
sound->setMuted(preferences->optionSoundVolume() == 0);
}
5 changes: 4 additions & 1 deletion src/libreminesgui.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
* LibreMines *
* Copyright (C) 2020-2021 Bruno Bollos Correa *
* Copyright (C) 2020-2022 Bruno Bollos Correa *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
Expand Down Expand Up @@ -36,6 +36,7 @@
#include "qlabel_adapted.h"
#include "qpushbutton_adapted.h"
#include "minefieldtheme.h"
#include "soundeffects.h"

/**
* @brief
Expand Down Expand Up @@ -285,5 +286,7 @@ private Q_SLOTS:
LibreMinesPreferencesDialog* preferences;

QDir dirAppData;

QScopedPointer<SoundEffects> sound;
};
#endif // LIBREMINESGUI_H
Loading

0 comments on commit b789b9b

Please sign in to comment.