Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
72 KB
Referenced Files
None
Subscribers
None
diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..446df0a
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,10 @@
+version: 2
+jobs:
+ build:
+ docker:
+ - image: ubuntu:xenial
+ steps:
+ - checkout
+ - run: apt-get update
+ - run: apt-get install cmake libsfml-dev g++ -y
+ - run: cmake .
diff --git a/.gitignore b/.gitignore
index 945e787..5f4a465 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,24 @@
+parts/
+prime/
+snap/
+stage/
+DeerPortal
+*.snap
*.o
enfucraft
enfucraft.pro.user
Makefile
docs/
pagan_board.pro.user
*.swo
*.swp
*.Release
*.Debug
*.debhelper.log
debian/deerportal
+MakeCache.txt
+CMakeFiles/
+CPackConfig.cmake
+CPackSourceConfig.cmake
+cmake_install.cmake
+CMakeCache.txt
diff --git a/.travis.yml b/.travis.yml
index f103d7a..1bae74e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,42 @@
-sudo: required
-dist: trusty
-language: cpp
+os:
+ - linux
+ - osx
+
compiler:
- gcc
-before_script:
- - sudo apt-get install -y libjpeg62-dev libsndfile1-dev libglew1.5 libglew1.5-dev libfreetype6 libjpeg-turbo8 libjpeg8 libopenal-data libopenal1 libxrandr2 libxrender1 libsoil1 cppcheck libsfml-dev
+ - clang
+
+# sudo: required
+# dist: trusty
+language: cpp
+# compiler:
+# - gcc
+
+addons:
+ apt:
+ packages:
+ - libsfml-dev
+
+
+matrix:
+ include:
+ - os: linux
+ dist: trusty
+ sudo: required
+ - os: osx
+ osx_image: xcode7.2
+# before_script:
+# - sudo apt-get install -y libjpeg62-dev libsndfile1-dev libglew1.5 libglew1.5-dev libfreetype6 libjpeg-turbo8 libjpeg8 libopenal-data libopenal1 libxrandr2 libxrender1 libsoil1 cppcheck libsfml-dev
+
+script:
+ lsb_release -a
+ qmake -makefile pagan_board.pro && make && make && cppcheck . --enable=all
+
+before_install:
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade cmake ; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install sfml ; fi
-script: qmake -makefile pagan_board.pro && make && make && cppcheck . --enable=all
+script:
+ - cmake .
+ - make
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5df94b2
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,93 @@
+#Change this if you need to target a specific CMake version
+cmake_minimum_required(VERSION 3.1)
+set (CMAKE_CXX_STANDARD 11)
+
+# Here must be also current version - opposite to debian files which has latest release version
+
+set(DEERPORTAL_MAJOR_VERSION 0)
+set(DEERPORTAL_MINOR_VERSION 7)
+set(DEERPORTAL_PATCH_VERSION 2)
+set(DEERPORTAL_VERSION
+ ${DEERPORTAL_MAJOR_VERSION}.${DEERPORTAL_MINOR_VERSION}.${DEERPORTAL_PATCH_VERSION})
+
+
+# Enable debug symbols by default
+# must be done before project() statement
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
+endif()
+# (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
+
+project(myproject)
+
+#target_compile_definitions(DeerPortal PRIVATE FOO=1 BAR=1)
+
+
+
+add_definitions(-DDEERPORTAL_VERSION="${DEERPORTAL_VERSION}.${CMAKE_BUILD_TYPE}")
+# Set version information in a config.h file
+# configure_file(
+# "${PROJECT_SOURCE_DIR}/config.h.in"
+# "${PROJECT_BINARY_DIR}/config.h"
+# )
+include_directories("${PROJECT_BINARY_DIR}")
+include_directories(${YOUR_DIRECTORY})
+
+# Define sources and executable
+set(EXECUTABLE_NAME "DeerPortal")
+add_executable(${EXECUTABLE_NAME}
+ main.cpp
+ animatedsprite.cpp
+ animation.cpp
+ banner.cpp
+ boarddiamond.cpp
+ boarddiamondseq.cpp
+ boardelem.cpp
+ boardelems.cpp
+ bubble.cpp
+ calendar.cpp
+ card.cpp
+ cardsdeck.cpp
+ cardslist.cpp
+ character.cpp
+ command.cpp
+ credits.cpp
+ data.cpp
+ elem.cpp
+ game.cpp
+ grouphud.cpp
+ guirounddice.cpp
+ guiwindow.cpp
+ hover.cpp
+ particlesystem.cpp
+ pile.cpp
+ playerhud.cpp
+ rotateelem.cpp
+ rounddice.cpp
+ selector.cpp
+ soundfx.cpp
+ textureholder.cpp
+ tilemap.cpp)
+
+
+# Detect and add SFML
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
+#Find any version 2.X of SFML
+#See the FindSFML.cmake file for additional details and instructions
+find_package(SFML 2 REQUIRED network audio graphics window system)
+if(SFML_FOUND)
+ include_directories(${SFML_INCLUDE_DIR})
+ target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
+endif()
+
+
+# Install target
+install(TARGETS ${EXECUTABLE_NAME} DESTINATION bin)
+
+
+# CPack packaging
+include(InstallRequiredSystemLibraries)
+# set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+set(CPACK_PACKAGE_VERSION_MAJOR "${DEERPORTAL_MAJOR_VERSION}")
+set(CPACK_PACKAGE_VERSION_MINOR "${DEERPORTAL_MINOR_VERSION}.${DEERPORTAL_PATCH_VERSION}")
+include(CPack)
diff --git a/README.md b/README.md
index 669c05c..e93de36 100644
--- a/README.md
+++ b/README.md
@@ -1,103 +1,89 @@
[![devcarpet](https://devcarpet.net/images/dc_black.png)](https://devcarpet.net)[![Build Status](https://travis-ci.org/deerportal/deerportal.svg?branch=master)](https://travis-ci.org/deerportal/deerportal) [![Build Status](https://semaphoreci.com/api/v1/bluszcz/deerportal/branches/master/badge.svg)](https://semaphoreci.com/bluszcz/deerportal) [![Ebert](https://ebertapp.io/github/deerportal/deerportal.svg)](https://ebertapp.io/github/deerportal/deerportal)
presents
Deerportal
-----------
![DeerPortal Game play](https://bluszcz.net/projects/games/deerportal/deerportal-game-about-how-human-can-be-upgraded-to-the-deer_772.png/@@images/image.png)
Deerportal is a open source (free as a speech, free as a beer) hybrid game which utilize board and card games mechanisms. World of the game is driven by four classical elemets along with Almighty Deer God.
Homepage: https://devcarpet.net/deerportal/
Collect the diamonds, execute actions on cards and survive the chaos of nature! Compete against 3 other players.
Features
--------
* 0-4 players mode
* changing seasons
* open source (zlib / cc-by 4.0)
SFML, Linux, OSX, Windows.
![DeerPortal MultiPlayer Mode](https://bluszcz.net/projects/games/deerportal/deerportal-game-about-how-human-can-be-upgraded-to-the-deer_771.png/@@images/image.png)
## Installation
### Compilation
-#### Ubuntu Trusty - Xenial
+#### Linux / OSX
```
-$ sudo apt-get install libsfml-devl
$ git clone https://github.com/deerportal/deerportal.git
$ cd deerportal
-$ qmake -makefile pagan_board.pro
+$ cmake .
$ make
-$ make install
-$ ../build_release_pagan_board/pagan_board
+$ ./DeerPortal
```
-#### Debian
+##### Debian
If you would like to see Deer Portal in Debian repositories, there is an opened bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826612 - please help :)
To make deb package locally:
```
$ git clone https://github.com/deerportal/deerportal.git
$ cd deerportal
$ fakeroot debian/rules binary
```
-#### Mac OSX
-
-You should have first installed SFML with dependencies: http://www.sfml-dev.org/tutorials/2.3/start-osx.php, thank you can do following:
-
-```
-$ git clone https://github.com/deerportal/deerportal.git
-$ cd deerportal
-$ cmake .
-$ make
-$ ./deerportal
-```
-
### Binary download
In our [releases](https://github.com/deerportal/deerportal/releases) section we are providing compiled binaries for Ubuntu (Trusty, Xenial) and Windows.
#### Ubuntu apt repo
If you want to have an easy installation via system apt, add one of the folowing (depends on your distro) to your /etc/apt/sources.list, if you have Trusty 14.04
```
deb http://deb.devcarpet.net/ubuntu trusty main
```
or for Xenial 16.04
```
deb http://deb.devcarpet.net/ubuntu xenial main
```
and later:
```
sudo apt-get update
sudo apt-get install deerportal
```
#### Development windows builds
* https://devcarpet.net/deerportal/downloads/windows/
#### Developer documentation
Following doxygen api docs has been created using our Jenkins based Continous Integration:
* https://devcarpet.net/deerportal/downloads/docs/html/
**Developed with [Devcarpet](https://devcarpet.net) platform.**
![SFML GAME](https://bluszcz.net/projects/games/deerportal/sfml-logo-small.png/@@images/image.png)
diff --git a/assets/fnt/8bitOperatorPlus-Bold.ttf b/assets/fnt/8bitOperatorPlus-Bold.ttf
deleted file mode 100644
index 63c7b5f..0000000
Binary files a/assets/fnt/8bitOperatorPlus-Bold.ttf and /dev/null differ
diff --git a/assets/fnt/8bitOperatorPlus-Regular.ttf b/assets/fnt/8bitOperatorPlus-Regular.ttf
deleted file mode 100644
index 80c12b9..0000000
Binary files a/assets/fnt/8bitOperatorPlus-Regular.ttf and /dev/null differ
diff --git a/assets/fnt/8bitOperatorPlus8-Bold.ttf b/assets/fnt/8bitOperatorPlus8-Bold.ttf
deleted file mode 100644
index 10ce55d..0000000
Binary files a/assets/fnt/8bitOperatorPlus8-Bold.ttf and /dev/null differ
diff --git a/assets/fnt/8bitOperatorPlus8-Regular.ttf b/assets/fnt/8bitOperatorPlus8-Regular.ttf
deleted file mode 100644
index bb5dc61..0000000
Binary files a/assets/fnt/8bitOperatorPlus8-Regular.ttf and /dev/null differ
diff --git a/assets/fnt/8bitOperatorPlusSC-Bold.ttf b/assets/fnt/8bitOperatorPlusSC-Bold.ttf
deleted file mode 100644
index c656c31..0000000
Binary files a/assets/fnt/8bitOperatorPlusSC-Bold.ttf and /dev/null differ
diff --git a/assets/fnt/8bitOperatorPlusSC-Regular.ttf b/assets/fnt/8bitOperatorPlusSC-Regular.ttf
deleted file mode 100644
index 306a9ff..0000000
Binary files a/assets/fnt/8bitOperatorPlusSC-Regular.ttf and /dev/null differ
diff --git a/assets/fnt/MorrisJensonInitialen.ttf b/assets/fnt/MorrisJensonInitialen.ttf
deleted file mode 100644
index 95eed1c..0000000
Binary files a/assets/fnt/MorrisJensonInitialen.ttf and /dev/null differ
diff --git a/assets/fnt/SIL Open Font License.txt b/assets/fnt/SIL Open Font License.txt
deleted file mode 100644
index 4c1508d..0000000
--- a/assets/fnt/SIL Open Font License.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-Copyright (c) 2009 - 2014 Grandoplex Productions (http://grandchaos9000.deviantart.com), with Reserved Font Name 8-bit Operator+.
-
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
-
-"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
-
-5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are not met.
-
-DISCLAIMER
-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 THE COPYRIGHT HOLDER 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.
diff --git a/assets/fnt/VCR_OSD_MONO_1.001.ttf b/assets/fnt/VCR_OSD_MONO_1.001.ttf
deleted file mode 100644
index dcca687..0000000
Binary files a/assets/fnt/VCR_OSD_MONO_1.001.ttf and /dev/null differ
diff --git a/cmake_modules/FindSFML.cmake b/cmake_modules/FindSFML.cmake
new file mode 100644
index 0000000..d2ec360
--- /dev/null
+++ b/cmake_modules/FindSFML.cmake
@@ -0,0 +1,364 @@
+# This script locates the SFML library
+# ------------------------------------
+#
+# Usage
+# -----
+#
+# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
+# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
+# example:
+# find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules
+#
+# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
+# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
+# example:
+# find_package(SFML COMPONENTS ...) # no specific version required
+# find_package(SFML 2 COMPONENTS ...) # any 2.x version
+# find_package(SFML 2.4 COMPONENTS ...) # version 2.4 or greater
+#
+# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
+# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
+# Since you have to link yourself all the SFML dependencies when you link it statically, the following
+# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
+# description below).
+# In case of static linking, the SFML_STATIC macro will also be defined by this script.
+# example:
+# set(SFML_STATIC_LIBRARIES TRUE)
+# find_package(SFML 2 COMPONENTS network system)
+#
+# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
+# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
+# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
+# are available for both release and debug modes.
+#
+# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
+# to tell CMake where SFML is.
+#
+# Output
+# ------
+#
+# This script defines the following variables:
+# - For each specified module XXX (system, window, graphics, network, audio, main):
+# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
+# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
+# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
+# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
+# - SFML_XXX_DEPENDENCIES: the list of libraries the module depends on, in case of static linking
+# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules
+# - SFML_FOUND: true if all the required modules are found
+# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
+# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
+#
+# example:
+# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
+# include_directories(${SFML_INCLUDE_DIR})
+# add_executable(myapp ...)
+# target_link_libraries(myapp ${SFML_LIBRARIES})
+
+# define the SFML_STATIC macro if static build was chosen
+if(SFML_STATIC_LIBRARIES)
+ add_definitions(-DSFML_STATIC)
+endif()
+
+# define the list of search paths for headers and libraries
+set(FIND_SFML_PATHS
+ ${SFML_ROOT}
+ $ENV{SFML_ROOT}
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /usr/local
+ /usr
+ /sw
+ /opt/local
+ /opt/csw
+ /opt)
+
+# find the SFML include directory
+find_path(SFML_INCLUDE_DIR SFML/Config.hpp
+ PATH_SUFFIXES include
+ PATHS ${FIND_SFML_PATHS})
+
+# check the version number
+set(SFML_VERSION_OK TRUE)
+if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
+ # extract the major and minor version numbers from SFML/Config.hpp
+ # we have to handle framework a little bit differently:
+ if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
+ set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
+ else()
+ set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
+ endif()
+ FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
+ STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
+ STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
+ STRING(REGEX REPLACE ".*#define SFML_VERSION_PATCH ([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}")
+ if (NOT "${SFML_VERSION_PATCH}" MATCHES "^[0-9]+$")
+ set(SFML_VERSION_PATCH 0)
+ endif()
+ math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}")
+
+ # if we could extract them, compare with the requested version number
+ if (SFML_VERSION_MAJOR)
+ # transform version numbers to an integer
+ math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}")
+
+ # compare them
+ if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
+ set(SFML_VERSION_OK FALSE)
+ endif()
+ else()
+ # SFML version is < 2.0
+ if (SFML_REQUESTED_VERSION GREATER 10900)
+ set(SFML_VERSION_OK FALSE)
+ set(SFML_VERSION_MAJOR 1)
+ set(SFML_VERSION_MINOR x)
+ set(SFML_VERSION_PATCH x)
+ endif()
+ endif()
+endif()
+
+# find the requested modules
+set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
+foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
+ string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
+ string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
+ set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
+
+ # no suffix for sfml-main, it is always a static library
+ if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
+ # release library
+ find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
+ NAMES ${FIND_SFML_COMPONENT_NAME}
+ PATH_SUFFIXES lib64 lib
+ PATHS ${FIND_SFML_PATHS})
+
+ # debug library
+ find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
+ NAMES ${FIND_SFML_COMPONENT_NAME}-d
+ PATH_SUFFIXES lib64 lib
+ PATHS ${FIND_SFML_PATHS})
+ else()
+ # static release library
+ find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
+ NAMES ${FIND_SFML_COMPONENT_NAME}-s
+ PATH_SUFFIXES lib64 lib
+ PATHS ${FIND_SFML_PATHS})
+
+ # static debug library
+ find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
+ NAMES ${FIND_SFML_COMPONENT_NAME}-s-d
+ PATH_SUFFIXES lib64 lib
+ PATHS ${FIND_SFML_PATHS})
+
+ # dynamic release library
+ find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
+ NAMES ${FIND_SFML_COMPONENT_NAME}
+ PATH_SUFFIXES lib64 lib
+ PATHS ${FIND_SFML_PATHS})
+
+ # dynamic debug library
+ find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG
+ NAMES ${FIND_SFML_COMPONENT_NAME}-d
+ PATH_SUFFIXES lib64 lib
+ PATHS ${FIND_SFML_PATHS})
+
+ # choose the entries that fit the requested link type
+ if(SFML_STATIC_LIBRARIES)
+ if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE)
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE})
+ endif()
+ if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG)
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG})
+ endif()
+ else()
+ if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE)
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE})
+ endif()
+ if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG})
+ endif()
+ endif()
+ endif()
+
+ if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
+ # library found
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
+
+ # if both are found, set SFML_XXX_LIBRARY to contain both
+ if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
+ optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
+ endif()
+
+ # if only one debug/release variant is found, set the other to be equal to the found one
+ if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
+ # debug and not release
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
+ endif()
+ if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
+ # release and not debug
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
+ endif()
+ else()
+ # library not found
+ set(SFML_FOUND FALSE)
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
+ set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
+ set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
+ endif()
+
+ # mark as advanced
+ MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
+ SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
+ SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
+ SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
+ SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
+ SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
+ SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
+
+ # add to the global list of libraries
+ set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
+endforeach()
+
+# in case of static linking, we must also define the list of all the dependencies of SFML libraries
+if(SFML_STATIC_LIBRARIES)
+
+ # detect the OS
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ set(FIND_SFML_OS_WINDOWS 1)
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ set(FIND_SFML_OS_LINUX 1)
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+ set(FIND_SFML_OS_FREEBSD 1)
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(FIND_SFML_OS_MACOSX 1)
+ endif()
+
+ # start with an empty list
+ set(SFML_DEPENDENCIES)
+ set(FIND_SFML_DEPENDENCIES_NOTFOUND)
+
+ # macro that searches for a 3rd-party library
+ macro(find_sfml_dependency output friendlyname)
+ # No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
+ find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
+ if(${${output}} STREQUAL "${output}-NOTFOUND")
+ unset(output)
+ set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
+ endif()
+ endmacro()
+
+ # sfml-system
+ list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT)
+ if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1)
+
+ # update the list -- these are only system libraries, no need to find them
+ if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX)
+ set(SFML_SYSTEM_DEPENDENCIES "pthread")
+ endif()
+ if(FIND_SFML_OS_LINUX)
+ set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt")
+ endif()
+ if(FIND_SFML_OS_WINDOWS)
+ set(SFML_SYSTEM_DEPENDENCIES "winmm")
+ endif()
+ set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES})
+ endif()
+
+ # sfml-network
+ list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT)
+ if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1)
+
+ # update the list -- these are only system libraries, no need to find them
+ if(FIND_SFML_OS_WINDOWS)
+ set(SFML_NETWORK_DEPENDENCIES "ws2_32")
+ endif()
+ set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES})
+ endif()
+
+ # sfml-window
+ list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT)
+ if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1)
+
+ # find libraries
+ if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
+ find_sfml_dependency(X11_LIBRARY "X11" X11)
+ find_sfml_dependency(XRANDR_LIBRARY "Xrandr" Xrandr)
+ endif()
+
+ if(FIND_SFML_OS_LINUX)
+ find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev)
+ endif()
+
+ # update the list
+ if(FIND_SFML_OS_WINDOWS)
+ set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32")
+ elseif(FIND_SFML_OS_LINUX)
+ set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} ${UDEV_LIBRARIES})
+ elseif(FIND_SFML_OS_FREEBSD)
+ set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} "usbhid")
+ elseif(FIND_SFML_OS_MACOSX)
+ set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon")
+ endif()
+ set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES})
+ endif()
+
+ # sfml-graphics
+ list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT)
+ if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1)
+
+ # find libraries
+ find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
+
+ # update the list
+ set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY})
+ set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
+ endif()
+
+ # sfml-audio
+ list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT)
+ if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1)
+
+ # find libraries
+ find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32)
+ find_sfml_dependency(OGG_LIBRARY "Ogg" ogg)
+ find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis)
+ find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile)
+ find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc)
+ find_sfml_dependency(FLAC_LIBRARY "FLAC" FLAC)
+
+ # update the list
+ set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
+ set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES})
+ endif()
+
+endif()
+
+# handle errors
+if(NOT SFML_VERSION_OK)
+ # SFML version not ok
+ set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})")
+ set(SFML_FOUND FALSE)
+elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND)
+ set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
+ set(SFML_FOUND FALSE)
+elseif(NOT SFML_FOUND)
+ # include directory or library not found
+ set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
+endif()
+if (NOT SFML_FOUND)
+ if(SFML_FIND_REQUIRED)
+ # fatal error
+ message(FATAL_ERROR ${FIND_SFML_ERROR})
+ elseif(NOT SFML_FIND_QUIETLY)
+ # error but continue
+ message("${FIND_SFML_ERROR}")
+ endif()
+endif()
+
+# handle success
+if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
+ message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
+endif()
diff --git a/game.cpp b/game.cpp
index be6c762..fb8e5e4 100644
--- a/game.cpp
+++ b/game.cpp
@@ -1,1169 +1,1178 @@
#include "game.h"
#include "particle.h"
#include "calendar.h"
#include <algorithm>
namespace efc {
int initScreenX = 1360;
int initScreenY = 768;
int currentSeason = 1;
int month = 0;
/*!
* \brief The ResultTable struct contains data for the end of the game screen.
*/
struct ResultTable
{
int playerNumber;
int playerResult;
bool reachedPortal;
bool reachedPortalFirst;
ResultTable(int number,int result, bool portal, bool portalFirst) :
playerNumber(number), playerResult(result), reachedPortal(portal), reachedPortalFirst(portalFirst) {}
bool operator < (const ResultTable& otherResult) const
{
if ((playerResult!=otherResult.playerResult) || ((reachedPortal==false) && (otherResult.reachedPortal==false)))
return (playerResult > otherResult.playerResult);
else if (reachedPortalFirst==true){
return true;
} else
{
return false;
}
;
}
};
/*!
* \brief Game::setTxtEndGameAmount orders the results text for the end of the game.
*/
void Game::setTxtEndGameAmount(){
std::string elementNames[4] = {"Water","Earth", "Fire", "Air"};
int width=1360;
// int height = 768;
// int startHeight = 100;
int separator = 40;
std::array<ResultTable, 4> results = {
{
ResultTable(0,players[0].cash, players[0].reachedPortal,players[0].reachedPortalFirst),
ResultTable(1,players[1].cash, players[1].reachedPortal,players[1].reachedPortalFirst),
ResultTable(2,players[2].cash, players[2].reachedPortal,players[2].reachedPortalFirst),
ResultTable(3,players[3].cash, players[3].reachedPortal,players[3].reachedPortalFirst)
}
};
std::vector < ResultTable > resultsVector;
txtSurvivors.clear();
txtLoosers.clear();
for (int i=0;i<4;i++)
{
resultsVector.push_back(results[i]);
};
std::sort(resultsVector.begin(), resultsVector.end());
txtWinner.setFont(gameFont);
txtWinner.setCharacterSize(40);
for (int i=0;i<4;i++)
{
int playerNumber = resultsVector[i].playerNumber;
std::string elementName = elementNames[playerNumber];
sf::Text tmpText;
tmpText.setFont(gameFont);
tmpText.setCharacterSize(25);
tmpText.setString(elementName+ " " + std::to_string(players[playerNumber].cash));
sf::FloatRect rectTxt = tmpText.getLocalBounds();
if (players[playerNumber].reachedPortal==true)
{
int counter = txtSurvivors.size();
tmpText.setPosition((1360/2)-(rectTxt.width/2),200+(counter*separator));
txtSurvivors.push_back(tmpText);
} else
{
int counter = txtLoosers.size();
tmpText.setPosition((width/2)-(rectTxt.width/2),540+(counter*separator));
txtLoosers.push_back(tmpText);
}
}
if (txtSurvivors.size()>0)
{
txtWinner.setString("Winner: " + txtSurvivors[0].getString());
txtSurvivors.erase(txtSurvivors.begin()+0);
}
txtWinner.setCharacterSize(40);
sf::FloatRect rectTxt = txtWinner.getLocalBounds();
txtWinner.setPosition((1360/2)-(rectTxt.width/2),120);
}
void Game::initBoard()
{
time_t t = time(0);
struct tm * now = localtime( & t );
int month = now->tm_mon + 1;
int day = now->tm_mday;
paganHolidayString = getHoliday(month, day);
paganHolidayTxt.setString(paganHolidayString);
sfxClick.setBuffer(sfxClickBuffer);
sfxDone.setBuffer(sfxDoneBuffer);
spriteBackgroundDark.setTexture(textures.backgroundDark);
spriteBackgroundDark.setPosition(0,0);
spriteLestBegin.setTexture(textures.textureLetsBegin);
viewTiles.setViewport(sf::FloatRect(0.15f,0.1f, 1.0f, 1.0f));
viewGui.setViewport(sf::FloatRect(0.806f,0.066f, 1, 1));
groupHud.setFont(&gameFont);
groupHud.setSeason(currentSeason);
groupHud.setRoundName(roundNumber);
cardsDeck.setFonts(&gameFont);
spriteBigDiamond.setTexture(textures.textureBigDiamond);
spriteBigDiamond.setPosition(474,342);
spriteBigDiamond.setColor(sf::Color (255, 255, 255,196));
restartGame();
launchNextPlayer();
endGameTxt.setFont(gameFont);
endGameTxt.setString("End of the Game");
endGameTxt.setCharacterSize(30);
sf::FloatRect ss = endGameTxt.getLocalBounds();
endGameTxt.setPosition((1360/2)-(ss.width/2),60);
setTxtEndGameAmount();
bubble.setPosition(players[turn].characters[0].getPosition().x-30,
players[turn].characters[0].getPosition().y-45);
txtSurvivorsLabel.setString("Survivors");
txtSurvivorsLabel.setFont(gameFont);
txtSurvivorsLabel.setCharacterSize(30);
sf::FloatRect rectSurvivors = txtSurvivorsLabel.getLocalBounds();
txtSurvivorsLabel.setPosition((1360/2)-(rectSurvivors.width/2),200);
txtLoosersLabel.setString("Digested by The Elements");
txtLoosersLabel.setFont(gameFont);
txtLoosersLabel.setCharacterSize(30);
sf::FloatRect rectLoosers = txtLoosersLabel.getLocalBounds();
txtLoosersLabel.setPosition((1360/2)-(rectLoosers.width/2),500);
credits.setTxt(0);
}
/*!
* \brief Game::restartGame sets all the variables to the default value
*/
void Game::restartGame()
{
Player playerHud1(&textures, &gameFont,0);
Player playerHud2(&textures, &gameFont,1);
Player playerHud3(&textures, &gameFont,2);
Player playerHud4(&textures, &gameFont,3);
players[0] = playerHud1;
players[1] = playerHud2;
players[3] = playerHud3;
players[2] = playerHud4;
players[0].setActive(true);
setCurrentNeighbours();
diceResultPlayer = 6;
players[turn].characters[0].diceResult = diceResultPlayer;
roundDice.setColor(turn);
for (int i=0;i<4;i++)
{
players[i].restartPlayer();
players[i].reachedPortal = false;
boardDiamonds.reorder(i);
bubble.setPosition(players[i].characters[0].getPosition().x-30,
players[i].characters[0].getPosition().y-45);
players[i].done=false;
}
numberFinishedPlayers = 0;
turn = 0;
currentSeason = 1;
roundNumber = 1;
month = 0;
cardsDeck.reloadCards();
deerModeActive = false;
deerModeCounter = 16;
}
void Game::setCurrentNeighbours ()
{
currentNeighbours = players[turn].getNeighbours();
}
/*!
* \brief Game::loadAssets
*/
void Game::loadAssets()
{
if (!gameFont.loadFromFile("assets/fnt/metal-mania.regular.ttf"))
{
std::exit(1);
}
if (!menuFont.loadFromFile("assets/fnt/metal-macabre.regular.ttf"))
{
std::exit(1);
}
menuBackground.setTexture(textures.textureMenu);
spriteDeerGod.setTexture(textures.textureDeerGod);
if (!shaderBlur.loadFromFile("assets/shaders/blur.frag", sf::Shader::Fragment))
std::exit(1);
if (!shaderPixel.loadFromFile("assets/shaders/pixelate.frag", sf::Shader::Fragment))
std::exit(1);
if (!shaderDark.loadFromFile("assets/shaders/dark.frag", sf::Shader::Fragment))
std::exit(1);
if (!textureBackgroundArt.loadFromFile("assets/img/background_land.png"))
std::exit(1);
if (!musicGame.openFromFile("assets/audio/game.ogg"))
std::exit(1);
// if (!musicBackground.openFromFile("assets/audio/wind2.ogg"))
// std::exit(1);
if (!musicMenu.openFromFile("assets/audio/menu.ogg"))
std::exit(1);
if (!sfxClickBuffer.loadFromFile("assets/audio/click.ogg"))
std::exit(1);
if (!sfxDoneBuffer.loadFromFile("assets/audio/done.ogg"))
std::exit(1);
// if (!textureBackground.loadFromFile("assets/img/background.png"))
// std::exit(1);
spriteBackgroundArt.setTexture(textureBackgroundArt);
menuTxt.setFont(gameFont);
menuTxt.setCharacterSize(60);
menuTxt.setString(gameTitle);
int width = menuTxt.getLocalBounds().width;
int height = menuTxt.getLocalBounds().height;
menuTxt.setPosition(1050-(width/2),750-(height/2)-150);
menuTxt.setColor(sf::Color(255, 255, 255, 85));
cardsDeck.setFonts(&gameFont);
paganHolidayTxt.setFont(gameFont);
paganHolidayTxt.setCharacterSize(20);
paganHolidayTxt.setPosition(20,20);
for (int i=0;i<4;i++)
{
playersSprites[i].setTexture(textureBackgroundArt);
playersSprites[i].setTextureRect(sf::IntRect(playersSpritesCords[i][0],
playersSpritesCords[i][1], 280, 280));
playersSprites[i].setPosition(playersSpritesCords[i][0], playersSpritesCords[i][1]);
}
}
void Game::showMenu()
{
musicMenu.play();
musicMenu.setLoop(true);
currentState = state_menu;
}
void Game::hideMenu()
{
musicMenu.stop();
}
void Game::showGameBoard()
{
// musicGame.setVolume(20);
musicGame.play();
musicGame.setLoop(true);
sfx.playLetsBegin();
currentState = state_setup_players;
// currentState = state_lets_begin;
}
void Game::endGame()
{
musicGame.stop();
currentState = state_end_game;
downTimeCounter = 0;
numberFinishedPlayers = 4;
setTxtEndGameAmount();
// musicBackground.stop();
}
void Game::throwDiceMove() {
// Throw a dice action
diceResultPlayer = roundDice.throwDiceSix();
players[turn].characters[0].diceResult=diceResultPlayer;
currentState = state_game;
bubble.state = BubbleState::MOVE;
nextRotateElem.reset();
prevRotateElem.reset();
}
/*!
* \brief Game::playerMakeMove move the player into the position on the map
* \param mousePos
*/
void Game::playerMakeMove(int mousePos) {
players[turn].setFigurePos(mousePos);
commandManager.processField(mousePos);
const int *possibleExit = std::find(std::begin(efc::endPlayers),
std::end(efc::endPlayers), mousePos);
if (possibleExit != efc::endPlayers+4) {
players[turn].done=true;
players[turn].reachedPortal=true;
commandManager.removeAllItems(turn);
if (numberFinishedPlayers == 0)
{
players[turn].reachedPortalFirst=true;
int turnover = (rand() % 2)+5;
players[turn].cash += turnover;
players[turn].updatePlayer();
startDeerMode();
}
sfx.soundPortal.play();
numberFinishedPlayers += 1;
if (numberFinishedPlayers > 3)
{
endGame();
return;
}
}
nextPlayer();
return;
}
int Game::mostDiamonds() const
{
std::array<int,4> results = {{players[0].cash,players[1].cash,players[2].cash,players[3].cash}};
auto minmax = std::minmax_element(std::begin(results), std::end(results));
int maxResult = *(minmax.second);
int result = 0;
int pos = -1;
for (int i=0; i<4;i++)
{
if (players[i].cash == maxResult)
{
result += 1;
pos = i;
}
};
if (result==1)
{
return pos;
}
return -1;
}
/*!
* \brief Game::handleLeftClick
* \param pos
* \param posFull
* \param mousePos
*/
void Game::handleLeftClick(sf::Vector2f pos,sf::Vector2f posFull, int mousePos) {
if (currentState==state_game)
{
if (players[turn].human)
{
std::array<int,2> movements = players[turn].getMovements(diceResultPlayer);
if ((mousePos==movements[0]) || (mousePos==movements[1]))
{
playerMakeMove(mousePos);
}
}
}
if (currentState==state_setup_players)
{
for (int i=0;i<4;i++)
{
sf::IntRect spriteHumanRect(players[i].spriteAI.getGlobalBounds());
if (spriteHumanRect.intersects(sf::IntRect(posFull.x, posFull.y, 1, 1)))
{
players[i].swapHuman();
}
}
sf::IntRect startGameRect(580,640,180,80);
if (startGameRect.intersects(sf::IntRect(posFull.x, posFull.y, 1, 1)))
{
bigDiamondActive = true;
banner.setText("start game");
currentState=state_roll_dice;
launchNextPlayer();
return;
}
}
else if (currentState==state_roll_dice)
{
if (players[turn].human){
sf::IntRect diceRect(roundDice.spriteDice.getGlobalBounds());
if (diceRect.intersects(sf::IntRect(posFull.x, posFull.y, 1, 1)))
{
throwDiceMove();
}
}
}
if (currentState==state_menu)
{
downTimeCounter = 0;
hideMenu();
showGameBoard();
return;
}
if (currentState==state_gui_end_round)
{
std::string resultCommand = guiRoundDice.getElem(pos);
command(resultCommand);
}
if (currentState==state_lets_begin)
{
if (downTimeCounter>1)
{
currentState = state_roll_dice;
restartGame();
launchNextPlayer();
return;
}
}
if (currentState==state_end_game)
{
if (downTimeCounter>2)
{
currentState = state_menu;
musicMenu.play();
restartGame();
return ;
// restartGame();
}
}
}
Game::Game(bool newTestMode):
screenSize(efc::initScreenX,efc::initScreenY),
viewFull(sf::FloatRect(00, 00, screenSize.x, screenSize.y)),
viewGui(sf::FloatRect(00, 00, screenSize.x, screenSize.y)),
viewTiles(sf::FloatRect(0, 0, 1360, 768)),
selector(efc::TILE_SIZE),
character(&textures, 3),
gameTitle("deerportal"),
roundDice(players),
roundNumber(1),
guiRoundDice(&textures),
boardDiamonds(&textures),
window(sf::VideoMode(efc::initScreenX, efc::initScreenY), "Deerportal - game about how human can be upgraded to the Deer"),
turn(0),
oscilator(-1),
oscilatorInc(true),
particleSystem( 430, 230),
commandManager(*this),
cardsDeck(&textures, &menuFont,&commandManager),
banner(&gameFont),
bigDiamondActive(false),
credits(&gameFont),
cpuTimeThinkingInterval(1.0f),
deerModeCounter(4),
- deerModeActive(false)
+ deerModeActive(false),
+ gameVersion()
{
testMode = newTestMode;
// TODO: perhaps get rid of the particles at all...
particleSystem.setDissolve( true );
particleSystem.setDissolutionRate( 10 );
particleSystem.setShape( Shape::CIRCLE );
particleSystem.fuel( 1000 );
playersSpritesCords[0][0] = 202;
playersSpritesCords[0][1] = 76;
playersSpritesCords[1][0] = 562;
playersSpritesCords[1][1] = 76;
playersSpritesCords[3][0] = 202;
playersSpritesCords[3][1] = 436;
playersSpritesCords[2][0] = 562;
playersSpritesCords[2][1] = 436;
textLoading.setString("loading...");
textLoading.setFont(menuFont);
textLoading.setPosition(200,200);
textLoading.setColor(sf::Color::White);
textLoading.setCharacterSize(10);
renderTexture.create(1360,768);
renderTexture.clear(sf::Color::White);
renderTexture.draw(textLoading);
renderTexture.display();
renderSprite.setTexture(renderTexture.getTexture());
numberFinishedPlayers = 0;
sf::Clock frameClock;
guiRoundDice.active = true;
showPlayerBoardElems = false;
window.setVerticalSyncEnabled(true);
std::srand (time(NULL));
window.clear(sf::Color(55,55,55));
renderTexture.draw(textLoading);
window.display();
loadAssets();
textLoading.setFont(menuFont);
textLoading.setPosition(200,200);
textLoading.setColor(sf::Color::White);
textLoading.setCharacterSize(10);
renderTexture.clear(sf::Color::Black);
renderTexture.draw(textLoading);
window.display();
+ gameVersion.setString("version: " + std::string(DEERPORTAL_VERSION));
+ gameVersion.setFont(gameFont);
+ gameVersion.setPosition(10,10);
+ gameVersion.setColor(sf::Color::White);
+ gameVersion.setCharacterSize(15);
+
+
initBoard();
renderTexture.clear(sf::Color::Black);
renderTexture.draw(textLoading);
renderTexture.display();
showMenu();
// run the main loop
if (testMode){
std::exit(0);
}
while (window.isOpen())
{
sf::Time frameTime = frameClock.restart();
// handle events
sf::Event event;
float xpos = 320.0f;
float ypos = 240.0f;
float xgrv = 0.0f;
float ygrv = 0.0f;
while (window.pollEvent(event))
{
switch (event.type) {
case sf::Event::Closed:
window.close(); break;
case sf::Event::KeyPressed:
if(event.key.code == sf::Keyboard::Escape )
window.close();
if( sf::Keyboard::isKeyPressed( sf::Keyboard::Space ) )
particleSystem.fuel( 200/* * window.getFrameTime() */);
if( sf::Keyboard::isKeyPressed( sf::Keyboard::A ) )
particleSystem.setPosition( --xpos, ypos );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::D ) )
particleSystem.setPosition( ++xpos, ypos );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::W ) )
particleSystem.setPosition( xpos, --ypos );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::S ) )
particleSystem.setPosition( xpos, ++ypos );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::Left ) )
particleSystem.setGravity( --xgrv * 0.1f, ygrv * 0.1f);
if( sf::Keyboard::isKeyPressed( sf::Keyboard::Right ) )
particleSystem.setGravity( ++xgrv * 0.1f, ygrv * 0.1f );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::Up ) )
particleSystem.setGravity( xgrv * 0.1f, --ygrv * 0.1f );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::Down ) )
particleSystem.setGravity( xgrv * 0.1f, ++ygrv * 0.1f );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::G ) )
particleSystem.setGravity( 0.0f, 0.0f );
if( sf::Keyboard::isKeyPressed( sf::Keyboard::P ) )
particleSystem.setPosition( 320.0f, 240.0f );
break;
default:
break;
}
sf::Vector2i localPositionTmp = sf::Mouse::getPosition(window);
sf::Vector2f localPosition = window.mapPixelToCoords(localPositionTmp,viewTiles);
// sf::Vector2f localPositionGui = window.mapPixelToCoords(localPositionTmp,viewGui);
sf::Vector2f localPositionFull = window.mapPixelToCoords(localPositionTmp,viewFull);
int mousePosX = (int)localPosition.x / efc::TILE_SIZE;
int mousePosY = (int)localPosition.y / efc::TILE_SIZE;
int mousePos = efc::transCords(sf::Vector2i(mousePosX, mousePosY));
if(event.type == sf::Event::Closed)
window.close();
// Showing mouse hover
if (currentState==state_game)
{
if ((localPosition.x>efc::TILE_SIZE*efc::BOARD_SIZE) || (localPosition.x<0) || (localPosition.y>efc::TILE_SIZE*efc::BOARD_SIZE) || (localPosition.y<0))
{
showPlayerBoardElems = false;
} else {
showPlayerBoardElems = true;
}
}
if ((localPosition.x>=0) && (localPosition.y>=0) && (localPosition.x<=efc::BOARD_SIZE*efc::TILE_SIZE) && (localPosition.y<=efc::BOARD_SIZE*efc::TILE_SIZE))
{
selector.setPosition((int) (localPosition.x / efc::TILE_SIZE)*efc::TILE_SIZE, ((int) localPosition.y / efc::TILE_SIZE)*efc::TILE_SIZE);
}
/*!
* Handling mouse click
*/
if (event.type == sf::Event::MouseButtonReleased)
{
if (event.mouseButton.button == sf::Mouse::Left)
handleLeftClick(localPosition,
localPositionFull, mousePos);
}
}
update(frameTime);
render(frameTime.asSeconds());
}
}
void Game::update(sf::Time frameTime) {
banner.update(frameTime);
credits.update(frameTime);
runningCounter += frameTime.asSeconds();
cpuTimeThinking -= frameTime.asSeconds();
if (oscilatorInc)
{
oscilator += frameTime.asSeconds();
} else {
oscilator -= frameTime.asSeconds();
}
if (oscilator<-1)
oscilatorInc = true;
if (oscilator>1)
oscilatorInc = false;
float modifier = sin(oscilator/2.5)*30.0f;
spriteBigDiamond.setPosition(474,342+modifier);
if (currentState==state_roll_dice)
{
if ((cpuTimeThinking<0) && (players[turn].human==false))
{
cpuTimeThinking = cpuTimeThinkingInterval;
throwDiceMove();
}
}
if (currentState==state_game)
{
std::array<int,2> currentMovements = players[turn].getMovements(diceResultPlayer);
if ((cpuTimeThinking<0) && (players[turn].human==false))
{
std::vector<int> listRandomPos;
if (currentMovements[0]>-1) {
listRandomPos.push_back(currentMovements[0]);
}
if (currentMovements[1]>-1) {
listRandomPos.push_back(currentMovements[1]);
}
unsigned int sizeRndPos = listRandomPos.size();
if (sizeRndPos==0) {
} else if (sizeRndPos==1) {
playerMakeMove(listRandomPos[0]);
} else if (sizeRndPos==2) {
if (deerModeActive)
{
playerMakeMove(listRandomPos[1]);
} else
{
if (players[turn].reachPortalMode == true)
{
playerMakeMove(listRandomPos[1]);
}
else
{
if (boardDiamonds.ifFieldIsEmpty(listRandomPos[1])==false)
{
playerMakeMove(listRandomPos[1]);
return;
}
if (boardDiamonds.ifFieldIsEmpty(listRandomPos[0])==false)
{
playerMakeMove(listRandomPos[0]);
return;
}
if ((boardDiamonds.ifFieldIsEmpty(listRandomPos[0])==false) && (boardDiamonds.ifFieldIsEmpty(listRandomPos[1])==false))
{
playerMakeMove(listRandomPos[1]);
return;
}
int randPos = rand() % 2;
playerMakeMove(listRandomPos[randPos]);
};
}
}
}
if (currentMovements[0]>-1)
{
prevRotateElem.spriteRotate.setPosition(players[turn].characters[0].leftChar.getPosition());
prevRotateElem.spriteRotate.move(10,20);
// Modificator to fit on the bigger view
prevRotateElem.spriteRotate.move(-202,-76);
prevRotateElem.update(frameTime);
prevRotateElem.setColor();
}
if (currentMovements[1]>-1)
{
nextRotateElem.spriteRotate.setPosition(players[turn].characters[0].rightChar.getPosition());
nextRotateElem.spriteRotate.move(10,20);
// Modificator to fit on the bigger view
nextRotateElem.spriteRotate.move(-202,-76);
nextRotateElem.update(frameTime);
nextRotateElem.setColor();
}
}
cardsDeck.update(frameTime);
for (int i=0;i<4;i++)
{
players[i].play();
players[i].update(frameTime);
}
if (currentState==state_lets_begin)
{
downTimeCounter += frameTime.asSeconds();
spriteLestBegin.setColor(sf::Color(255,255,255,255-(downTimeCounter*35)));
if (downTimeCounter>5)
{
currentState = state_roll_dice;
bubble.state = BubbleState::DICE;
}
}
if (currentState==state_end_game)
{
downTimeCounter += frameTime.asSeconds();
}
bubble.update(frameTime);
}
/*!
* \brief Game::nextRound is happening each every 4 months
*/
void Game::nextRound() {
turn = 0;
// std::string result = roundDice.drawRound();
roundNumber += 1;
month++;
if (month==13)
month=1;
if (month%4==0)
currentSeason++;
if (currentSeason>3)
currentSeason=0;
// if (players[turn].done==true)
// nextPlayer();
launchNextPlayer();
}
/*!
* \brief Game::nextPlayer calculates which player should play
*/
void Game::nextPlayer(){
// End of game - we don't calculate more players
if (currentState==state_end_game)
{
return;
}
// End of game - we don't calculate more players
if (numberFinishedPlayers==4)
{
endGame();
return ;
}
// Update old player
players[turn].updatePlayer();
if (turn>2)
{
nextRound();
return;
}
turn++;
launchNextPlayer();
}
void Game::launchNextPlayer(){
if (deerModeActive)
{
deerModeCounter -= 1;
}
if (deerModeCounter<0)
{
endGame();
return ;
}
// Just control
if (players[turn].done==true)
{
nextPlayer();
return;
}
// Frozen player
if (players[turn].frozenLeft>0)
{
players[turn].frozenLeft -= 1;
nextPlayer();
return;
}
// Here we process new player
selector.changeColor(turn);
for (int i=0;i<4;i++)
{
if (i==turn)
{
players[i].setActive(true);
currentNeighbours = players[i].getNeighbours();
}
else
players[i].setActive(false);
}
sfxClick.play();
diceResultPlayer = 6;
roundDice.setDiceTexture(diceResultPlayer);
players[turn].characters[0].diceResult = diceResultPlayer;
groupHud.setRoundName(roundNumber);
if (deerModeActive==false)
{
groupHud.setSeason(currentSeason);
groupHud.setMonthName(month%4);
} else
{
groupHud.setDeerModeActive();
int number = (deerModeCounter/4);
if (deerModeCounter<16)
number += 1;
if (number<0)
{
endGame();
return;
}
groupHud.setDeerModeCounter(number);
}
currentState = state_roll_dice;
bubble.state = BubbleState::DICE;
roundDice.setColor(turn);
bubble.setPosition(players[turn].characters[0].getPosition().x-30,
players[turn].characters[0].getPosition().y-45);
cpuTimeThinking = cpuTimeThinkingInterval;
if (mostDiamonds()==turn)
{
players[turn].reachPortalMode = true;
} else {
players[turn].reachPortalMode = false;
}
}
void Game::drawPlayersGui(){
for (int i=0;i<4;i++)
{
renderTexture.draw(players[i]);
}
}
void Game::drawSquares() {
if (showPlayerBoardElems)
{
renderTexture.draw(selector);
}
}
void Game::drawBaseGame()
{
renderTexture.setView(viewTiles);
for (int i=0;i<4;i++)
{
renderTexture.draw(players[i].elems);
}
drawSquares();
renderTexture.setView(viewGui);
renderTexture.setView(viewTiles);
renderTexture.setView(viewTiles); // Yeah Katia's inspiration
shaderBlur.setParameter("blur_radius", sin(runningCounter*0.01f) );
// renderTexture.draw(gameBackground);
renderTexture.setView(viewFull);
// renderTexture.draw(spriteBackgroundArt, &shaderDark);
// spriteBackgroundArt.setColor(sf::Color(255, 255, 255, 208));
shaderBlur.setParameter("blur_radius", 0.01);
// shaderBlur.setParameter("blur_radius", sin(runningCounter*0.01) );
// shaderBlur.setParameter("blur_radius", sin(runningCounter*0.01) );
shaderPixel.setParameter("pixel_threshold", sin(runningCounter* 0.005f));
renderTexture.draw(spriteBackgroundArt);
spriteBackgroundArt.setColor(sf::Color(255, 255, 255));
shaderBlur.setParameter("blur_radius", sin(runningCounter* 0.05f)/2);
renderTexture.draw(cardsDeck);
if (currentState==state_roll_dice)
{
spriteBackgroundArt.setColor(sf::Color(255, 255, 255));
shaderBlur.setParameter("blur_radius", sin(runningCounter* 0.5f)/4);
renderTexture.draw(roundDice.spriteDice);
}
else
renderTexture.draw(roundDice.spriteDice);
renderTexture.setView(viewTiles);
drawSquares();
}
void Game::drawCharacters(){
if (currentState==state_game)
{
std::array<int,2> currentMovements = players[turn].characters[0].getMovements(diceResultPlayer);
if (currentMovements[1]>-1)
{
if (nextRotateElem.active)
renderTexture.draw(nextRotateElem);
}
if (currentMovements[0]>-1)
{
if (prevRotateElem.active)
renderTexture.draw(prevRotateElem);
}
}
renderTexture.setView(viewFull);
shaderBlur.setParameter("blur_radius", 0.005f);
for (int i=0;i<4;i++)
{
for (auto&& j: players[i].characters)
{
if (currentState==state_game)
j.drawMovements = true;
else
j.drawMovements = false;
renderTexture.draw(j);
// renderTexture.draw(j, &shaderBlur);
}
}
}
/*!
* \brief Game::render main function responsible for drawing all elements
* \param deltaTime
*/
void Game::render(float deltaTime)
{
window.clear();
renderTexture.clear();
if ((currentState==state_game) or (currentState==state_roll_dice))
{
renderTexture.setView(viewFull);
renderTexture.draw(spriteBackgroundDark);
renderTexture.setView(viewTiles);
drawBaseGame();
renderTexture.setView(viewFull);
renderTexture.draw(groupHud);
renderTexture.setView(viewTiles);
drawCharacters();
renderTexture.draw(boardDiamonds);
renderTexture.draw(bubble);
renderTexture.setView(viewFull);
drawPlayersGui();
renderTexture.setView(viewFull);
} else if (currentState==state_setup_players) {
renderTexture.setView(viewFull);
renderTexture.draw(spriteDeerGod);
for (int i=0;i<4;i++)
{
renderTexture.draw(players[i].spriteAI);
}
} else if (currentState==state_gui_elem) {
renderTexture.setView(viewFull);
shaderBlur.setParameter("blur_radius", 2);
renderTexture.draw(spriteBackgroundDark, &shaderBlur);
drawBaseGame();
drawCharacters();
renderTexture.setView(viewFull);
renderTexture.draw(groupHud);
} else if (currentState==state_menu) {
// shaderBlur.setParameter("blur_radius", 15);
renderTexture.draw(menuBackground);
// // renderTexture.draw(menuTxt, &shaderBlur);
// renderTexture.draw(menuTxt);
renderTexture.draw(paganHolidayTxt);
+ renderTexture.draw(gameVersion);
renderTexture.draw(credits);
} else if (currentState==state_lets_begin) {
renderTexture.setView(viewFull);
shaderBlur.setParameter("blur_radius", 4);
renderTexture.draw(spriteBackgroundDark, &shaderBlur);
renderTexture.setView(viewTiles);
drawBaseGame();
drawCharacters();
renderTexture.draw(boardDiamonds, &shaderBlur);
renderTexture.setView(viewFull);
drawPlayersGui();
renderTexture.draw(spriteLestBegin,&shaderBlur);
} else if (currentState==state_gui_end_round){
renderTexture.setView(viewFull);
renderTexture.draw(spriteBackgroundDark);
drawBaseGame();
shaderBlur.setParameter("blur_radius", 0.05f);
renderTexture.draw(guiRoundDice, &shaderBlur);
renderTexture.setView(viewFull);
renderTexture.draw(groupHud);
}
else if (currentState==state_end_game){
renderTexture.setView(viewFull);
renderTexture.draw(spriteBackgroundDark);
renderTexture.draw(spriteLestBegin,&shaderBlur);
renderTexture.draw(endGameTxt);
// for (int i=0;i<4;i++){
// if (players[i].reachedPortal)
// renderTexture.draw(endGameTxtAmount[i]);
// }
renderTexture.draw(txtWinner);
renderTexture.draw(txtSurvivorsLabel);
for (unsigned int i=0; i<txtSurvivors.size();i++) {
renderTexture.draw(txtSurvivors[i]);
}
renderTexture.draw(txtLoosersLabel);
for (unsigned int i=0; i<txtLoosers.size();i++) {
renderTexture.draw(txtLoosers[i]);
}
}
if (bigDiamondActive)
renderTexture.draw(spriteBigDiamond);
if (banner.active)
renderTexture.draw(banner);
renderTexture.display();
renderSprite.setTexture(renderTexture.getTexture());
shaderBlur.setParameter("blur_radius", sin(deltaTime)*0.015f);
shaderBlur.setParameter("blur_radius", 0.0003f);
window.draw(renderSprite, &shaderBlur);
particleSystem.remove();
particleSystem.update();
particleSystem.render();
window.draw( particleSystem.getSprite() );
window.display();
}
void Game::command(std::string command){
if (command.compare("end_of_round")==0)
{
std::string subResult = command.substr(13);
guiRoundDice.active = true;
guiRoundDice.setTitle(subResult);
currentState = state_gui_end_round;
}
if (command=="end_turn")
nextPlayer();
}
/*!
* \brief Game::startDeerMode launches last episode of the game
*/
void Game::startDeerMode() {
deerModeActive = true;
deerModeCounter = 16;
banner.setText("deer mode");
bigDiamondActive = false;
sfx.soundDeerMode.play();
}
}
diff --git a/game.h b/game.h
index 8e6f3de..e70b1c4 100644
--- a/game.h
+++ b/game.h
@@ -1,220 +1,221 @@
#ifndef GAME_H
#define GAME_H
#include <stdlib.h>
#include <iostream>
#include <ctime>
#include <time.h> /* time */
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include "command.h"
#include "tilemap.h"
#include "selector.h"
#include "playerhud.h"
#include "textureholder.h"
#include "hover.h"
#include "guiwindow.h"
#include "rounddice.h"
#include "guirounddice.h"
#include "grouphud.h"
#include "animatedsprite.h"
#include "character.h"
#include "rotateelem.h"
#include "boarddiamondseq.h"
#include "soundfx.h"
#include "cardsdeck.h"
#include "calendar.h"
#include "particle.h"
#include "bubble.h"
//class Command;
#include "banner.h"
#include "credits.h"
namespace efc {
extern int initScreenX;
extern int initScreenY;
/*!
* \brief Game is a main class of the Deer Portal - contains most logic but also rendering.
*/
class Game
{
public:
sf::Vector2i screenSize;
sf::View viewFull;
sf::View viewGui;
sf::View viewTiles;
void setTxtEndGameAmount();
private:
Selector selector;
Character character;
std::string gameTitle;
std::string paganHolidayString;
RoundDice roundDice;
int roundNumber;
GuiRoundDice guiRoundDice;
public:
Game(bool newTestMode);
BoardDiamondSeq boardDiamonds;
sf::RenderWindow window;
sf::RenderTexture renderTexture;
sf::Sprite renderSprite;
Player players[4];
SoundFX sfx;
int turn;
private:
void initBoard();
void restartGame();
void loadAssets();
void drawPlayersGui();
void drawSquares();
void drawMenu();
float runningCounter;
float oscilator;
bool oscilatorInc;
sf::Sprite playersSprites[4] ;
int playersSpritesCords[4][2];
enum states {
state_init,
state_menu,
state_setup_players,
state_lets_begin,
state_roll_dice,
state_game,
state_gui_elem,
state_select_building,
state_gui_end_round,
state_end_game,
state_quit
};
states currentState;
sf::Sprite spriteDeerGod;
sf::Sprite spriteBackgroundDark;
sf::Sprite spriteLestBegin;
sf::Texture textureBackgroundArt;
sf::Sprite spriteBackgroundArt;
sf::Texture textureTiles;
sf::Texture textureFaces;
sf::Font gameFont;
sf::Font menuFont;
sf::Text menuTxt;
sf::Text endGameTxt;
sf::Text endGameTxtAmount[4];
sf::Text paganHolidayTxt;
+ sf::Text gameVersion;
sf::Shader shaderBlur;
sf::Shader shaderPixel;
sf::Shader shaderDark;
int mapSize;
int level[256];
int levelElems[256];
TextureHolder textures;
std::set<int> currentNeighbours;
void command(std::string command);
int selectedPos;
void update(sf::Time frameTime);
void render(float deltaTime);
ParticleSystem particleSystem;
void setCurrentNeighbours ();
void nextPlayer();
void launchNextPlayer();
void nextRound();
sf::Sprite menuBackground;
sf::Sprite seasons[4];
sf::Music musicGame;
sf::Music musicMenu;
sf::SoundBuffer sfxClickBuffer;
sf::Sound sfxClick;
sf::SoundBuffer sfxDoneBuffer;
sf::Sound sfxDone;
void showMenu();
void hideMenu();
void showGameBoard();
GroupHud groupHud;
/*!
* \brief showPlayerBoardElems defines if show mouse hover for the player
*/
bool showPlayerBoardElems;
void drawBaseGame();
int month;
Animation walkingAnimationDown;
Animation walkingAnimationUp;
Animation walkingAnimationLeft;
Animation walkingAnimationRight;
Animation* currentAnimation;
AnimatedSprite animatedSprite;
void drawCharacters();
void handleLeftClick(sf::Vector2f pos, sf::Vector2f posFull, int mousePos);
std::set<int> busyTiles;
int diceResultPlayer;
int numberFinishedPlayers;
RotateElem nextRotateElem;
RotateElem prevRotateElem;
void endGame();
float downTimeCounter;
Command commandManager;
sf::Text textLoading;
public:
CardsDeck cardsDeck;
void startDeerMode();
sf::Text txtWinner;
sf::Text txtSurvivorsLabel;
sf::Text txtLoosersLabel;
std::vector<sf::Text> txtSurvivors;
std::vector<sf::Text> txtLoosers;
void throwDiceMove();
void playerMakeMove(int mousePos);
float cpuTimeThinking;
Banner banner;
sf::Sprite spriteBigDiamond;
bool bigDiamondActive;
int mostDiamonds() const;
Credits credits;
float cpuTimeThinkingInterval;
private:
Bubble bubble;
int deerModeCounter;
bool deerModeActive;
public:
bool testMode;
};
}
#endif // GAME_H
diff --git a/scripts/build_windows_mxe.sh b/scripts/build_windows_mxe.sh
new file mode 100644
index 0000000..d6625f8
--- /dev/null
+++ b/scripts/build_windows_mxe.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+rm -rf builds/build_release_deerportal_win32/*
+export PATH=/home/services/mxe/usr/bin/:~/mxe/usr/bin/:$PATH
+~/mxe/usr/i686-w64-mingw32.static/qt/bin/qmake deerportal_windows.pro "DESTDIR=build_release_deerportal_win32"
+echo $PATH
+make
+make install
+ls -lah builds/build_release_deerportal_win32
+cd builds
+export FILENAME="deerportal_win32-`date +%Y%m%d%H%M%S`.zip"
+zip -9 -r $FILENAME build_release_deerportal_win32/
+ls -lah $FILENAME
+cp $FILENAME /mnt/deerportal_downloads/windows/
\ No newline at end of file
diff --git a/snapcraft.yaml b/snapcraft.yaml
new file mode 100644
index 0000000..4ed20d4
--- /dev/null
+++ b/snapcraft.yaml
@@ -0,0 +1,30 @@
+name: deerportal
+version: "0.7.2.dev"
+summary: DeerPortal game
+description: Some description for the game
+grade: stable
+confinement: strict
+apps:
+ deerportal:
+ command: desktop-launch DeerPortal
+
+ plugs:
+ - x11
+ - opengl
+ - pulseaudio
+ - desktop
+ - desktop-legacy
+ - unity7
+
+parts:
+ deer-portal:
+ plugin: cmake
+ source: https://github.com/deerportal/deerportal.git
+ source-branch: cmake-tests
+ source-depth: 1
+ build-packages:
+ - libsfml-dev
+ - libgl1-mesa-dri
+ - libopenal-dev
+
+ after: [desktop-gtk3]

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jun 17, 9:27 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
70837
Default Alt Text
(72 KB)

Event Timeline