diff --git a/.gitignore b/.gitignore index e51f032..b959e6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,74 +1,5 @@ # This file is used to ignore files which are generated # ---------------------------------------------------------------------------- -*~ -*.autosave -*.a -*.core -*.moc -*.o -*.obj -*.orig -*.rej -*.so -*.so.* -*_pch.h.cpp -*_resource.rc -*.qm -.#* -*.*# -core -!core/ -tags -.DS_Store -.directory -*.debug -Makefile* -*.prl -*.app -moc_*.cpp -ui_*.h -qrc_*.cpp -Thumbs.db -*.res -*.rc -/.qmake.cache -/.qmake.stash - -# qtcreator generated files -*.pro.user* - -# xemacs temporary files -*.flc - -# Vim temporary files -.*.swp - -# Visual Studio generated files -*.ib_pdb_index -*.idb -*.ilk -*.pdb -*.sln -*.suo -*.vcproj -*vcproj.*.*.user -*.ncb -*.sdf -*.opensdf -*.vcxproj -*vcxproj.* - -# MinGW generated files -*.Debug -*.Release - -# Python byte code -*.pyc - -# Binaries -# -------- -*.dll -*.exe - -*.stash +build +*.user diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0e44cad --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.5) + +project(cirno-puzzle LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wpedantic -g") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build) +set(CMAKE_RESOURCE_DIRECTORY ${CMAKE_SOURCE_DIR}/resources) + +include_directories(${CMAKE_SOURCE_DIR}/include) +file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.h" "include/*.h") + +find_package(SFML REQUIRED graphics audio window system) +add_executable(cirno-puzzle ${SOURCES} ${HEADER_FILES} ) +target_link_libraries(cirno-puzzle sfml-system sfml-audio sfml-graphics) + +file(COPY "${CMAKE_RESOURCE_DIRECTORY}" DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) diff --git a/build-debug/background_music.ogg b/build-debug/background_music.ogg deleted file mode 100644 index d428853..0000000 Binary files a/build-debug/background_music.ogg and /dev/null differ diff --git a/build-debug/footstep_sound.wav b/build-debug/footstep_sound.wav deleted file mode 100644 index 8b5105b..0000000 Binary files a/build-debug/footstep_sound.wav and /dev/null differ diff --git a/build-debug/sfml-test b/build-debug/sfml-test deleted file mode 100755 index d9c7f87..0000000 Binary files a/build-debug/sfml-test and /dev/null differ diff --git a/build-debug/test_map b/build-debug/test_map deleted file mode 100644 index cb31002..0000000 --- a/build-debug/test_map +++ /dev/null @@ -1,14 +0,0 @@ -size -7 7 -map -2 2 2 2 2 2 2 -2 0 3 0 0 6 2 -2 0 0 1 0 0 2 -2 0 0 1 1 0 2 -2 1 1 2 2 2 2 -2 0 0 0 4 0 2 -2 2 2 2 2 2 2 -trigger -1 5 4 5 6 3 1 3 1 -charge -1 2 2 diff --git a/build-release/font/Bitstream Vera License.txt b/build-release/font/Bitstream Vera License.txt deleted file mode 100644 index cf00835..0000000 --- a/build-release/font/Bitstream Vera License.txt +++ /dev/null @@ -1,123 +0,0 @@ -Bitstream Vera Fonts Copyright - -The fonts have a generous copyright, allowing derivative works (as -long as "Bitstream" or "Vera" are not in the names), and full -redistribution (so long as they are not *sold* by themselves). They -can be be bundled, redistributed and sold with any software. - -The fonts are distributed under the following copyright: - -Copyright -========= - -Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream -Vera is a trademark of Bitstream, Inc. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of the fonts accompanying this license ("Fonts") and associated -documentation files (the "Font Software"), to reproduce and distribute -the Font Software, including without limitation the rights to use, -copy, merge, publish, distribute, and/or sell copies of the Font -Software, and to permit persons to whom the Font Software is furnished -to do so, subject to the following conditions: - -The above copyright and trademark notices and this permission notice -shall be included in all copies of one or more of the Font Software -typefaces. - -The Font Software may be modified, altered, or added to, and in -particular the designs of glyphs or characters in the Fonts may be -modified and additional glyphs or characters may be added to the -Fonts, only if the fonts are renamed to names not containing either -the words "Bitstream" or the word "Vera". - -This License becomes null and void to the extent applicable to Fonts -or Font Software that has been modified and is distributed under the -"Bitstream Vera" names. - -The Font Software may be sold as part of a larger software package but -no copy of one or more of the Font Software typefaces may be sold by -itself. - -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL -BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, -OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT -SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. - -Except as contained in this notice, the names of Gnome, the Gnome -Foundation, and Bitstream Inc., shall not be used in advertising or -otherwise to promote the sale, use or other dealings in this Font -Software without prior written authorization from the Gnome Foundation -or Bitstream Inc., respectively. For further information, contact: -fonts at gnome dot org. - -Copyright FAQ -============= - - 1. I don't understand the resale restriction... What gives? - - Bitstream is giving away these fonts, but wishes to ensure its - competitors can't just drop the fonts as is into a font sale system - and sell them as is. It seems fair that if Bitstream can't make money - from the Bitstream Vera fonts, their competitors should not be able to - do so either. You can sell the fonts as part of any software package, - however. - - 2. I want to package these fonts separately for distribution and - sale as part of a larger software package or system. Can I do so? - - Yes. A RPM or Debian package is a "larger software package" to begin - with, and you aren't selling them independently by themselves. - See 1. above. - - 3. Are derivative works allowed? - Yes! - - 4. Can I change or add to the font(s)? - Yes, but you must change the name(s) of the font(s). - - 5. Under what terms are derivative works allowed? - - You must change the name(s) of the fonts. This is to ensure the - quality of the fonts, both to protect Bitstream and Gnome. We want to - ensure that if an application has opened a font specifically of these - names, it gets what it expects (though of course, using fontconfig, - substitutions could still could have occurred during font - opening). You must include the Bitstream copyright. Additional - copyrights can be added, as per copyright law. Happy Font Hacking! - - 6. If I have improvements for Bitstream Vera, is it possible they might get - adopted in future versions? - - Yes. The contract between the Gnome Foundation and Bitstream has - provisions for working with Bitstream to ensure quality additions to - the Bitstream Vera font family. Please contact us if you have such - additions. Note, that in general, we will want such additions for the - entire family, not just a single font, and that you'll have to keep - both Gnome and Jim Lyles, Vera's designer, happy! To make sense to add - glyphs to the font, they must be stylistically in keeping with Vera's - design. Vera cannot become a "ransom note" font. Jim Lyles will be - providing a document describing the design elements used in Vera, as a - guide and aid for people interested in contributing to Vera. - - 7. I want to sell a software package that uses these fonts: Can I do so? - - Sure. Bundle the fonts with your software and sell your software - with the fonts. That is the intent of the copyright. - - 8. If applications have built the names "Bitstream Vera" into them, - can I override this somehow to use fonts of my choosing? - - This depends on exact details of the software. Most open source - systems and software (e.g., Gnome, KDE, etc.) are now converting to - use fontconfig (see www.fontconfig.org) to handle font configuration, - selection and substitution; it has provisions for overriding font - names and subsituting alternatives. An example is provided by the - supplied local.conf file, which chooses the family Bitstream Vera for - "sans", "serif" and "monospace". Other software (e.g., the XFree86 - core server) has other mechanisms for font substitution. \ No newline at end of file diff --git a/build-release/font/VeraMono.ttf b/build-release/font/VeraMono.ttf deleted file mode 100644 index 139f0b4..0000000 Binary files a/build-release/font/VeraMono.ttf and /dev/null differ diff --git a/build-release/sfml-test b/build-release/sfml-test deleted file mode 100755 index d9f572f..0000000 Binary files a/build-release/sfml-test and /dev/null differ diff --git a/build-release/test_map b/build-release/test_map deleted file mode 100644 index c4c0b65..0000000 --- a/build-release/test_map +++ /dev/null @@ -1,10 +0,0 @@ -size -7 7 -map -2 2 2 2 2 2 2 -2 0 0 0 0 0 2 -2 0 0 1 0 0 2 -2 0 0 1 1 0 2 -2 1 1 2 2 2 2 -2 0 0 0 0 0 2 -2 2 2 2 2 2 2 diff --git a/src/audio.h b/include/audio.h similarity index 74% rename from src/audio.h rename to include/audio.h index eee26c2..9f46231 100644 --- a/src/audio.h +++ b/include/audio.h @@ -1,5 +1,4 @@ -#ifndef AUDIO_H -#define AUDIO_H +#pragma once #include #include @@ -23,11 +22,8 @@ private: sf::Sound sound; }; - using SfMusicPtr = std::unique_ptr; - using SoundEffectPtr = std::unique_ptr; - - std::array array_sounds; - SfMusicPtr background_music; + std::array, N_SOUNDS> array_sounds; + std::unique_ptr background_music; public: Audio(const std::string &background_file_name, std::array &&sounds_paths); @@ -41,7 +37,3 @@ public: void pauseBackground(); void setBackgroundVolume(const float &volume); }; - -using AudioPtr = std::unique_ptr