Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
diff --git a/snapcraft.yaml b/snapcraft.yaml
index fbc4047..0aa3aff 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,73 +1,72 @@
base: core18
name: deerportal
version: "0.8"
summary: Deer Portal" snap
description: Board game where you need to transfer yourself into the Deer God
grade: stable
confinement: strict
-#architectures:
-# - build-on: amd6#4
-# run-on: [amd64, i386]
apps:
deerportalsnap:
command: DeerPortal
+ environment:
+ DP_DIR: "$SNAP"
plugs:
- audio-playback
- desktop
- desktop-legacy
# - gsettings
# - home
- opengl
- pulseaudio
- unity7
- wayland
- x11
# - alsa
parts:
# alsa:
# after: [alsa-lib, alsa-plugins]
# alsa-plugins:
# after: [alsa-lib]
source-deerportal:
plugin: cmake
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
source: .
source-type: local
# source-depth: 1
build-packages:
- g++
- libsfml-dev
# - libgl1-mesa-dri
# - libopenal-dev
# - libsndio-dev
# stage-packages:
# - libc6
# - alsa
stage-packages:
- libasound2
- libflac8
- libfreetype6
- libgl1
- libglvnd0
- libglx0
- libjpeg-turbo8
- libogg0
- libopenal1
- libpng16-16
- libsfml-audio2.4
- libsfml-graphics2.4
- libsfml-system2.4
- libsfml-window2.4
- libsndio6.1
- libvorbis0a
- libvorbisenc2
- libvorbisfile3
- libx11-6
- libxau6
- libxcb1
- libxdmcp6
- libxext6
- libxrandr2
- libxrender1
diff --git a/src/filetools.h b/src/filetools.h
new file mode 100644
index 0000000..ed6a69a
--- /dev/null
+++ b/src/filetools.h
@@ -0,0 +1,13 @@
+#include <string>
+
+std::string get_full_path(std::string path)
+{
+ std::string new_path;
+ if ( getenv ( "DP_DIR" ) != NULL )
+ {
+ new_path = std::string(getenv("DP_DIR")) + path ;
+ return new_path;
+ }
+
+ return path;
+}
\ No newline at end of file
diff --git a/src/filetools.h.gch b/src/filetools.h.gch
new file mode 100644
index 0000000..9a4a3a5
Binary files /dev/null and b/src/filetools.h.gch differ
diff --git a/src/rounddice.cpp b/src/rounddice.cpp
index 07d14a8..58e08c2 100644
--- a/src/rounddice.cpp
+++ b/src/rounddice.cpp
@@ -1,68 +1,68 @@
#include "rounddice.h"
-
+#include "filetools.h"
RoundDice::RoundDice(Player (&players)[4])
{
playersHud = players;
diceResult = 1;
diceResultSix = 6;
diceSize = 150;
- if (!sfxDiceBuffer.loadFromFile(ASSETS_PATH"assets/audio/dice.ogg"))
+ if (!sfxDiceBuffer.loadFromFile(get_full_path(ASSETS_PATH"assets/audio/dice.ogg")))
std::exit(1);
if (!textureDice.loadFromFile(ASSETS_PATH"assets/img/diceWhite.png"))
std::exit(1);
spriteDice.setTexture(textureDice);
sfxDice.setBuffer(sfxDiceBuffer);
sfxDice.setVolume(12);
spriteDice.setPosition(1140,550);
setDiceTexture();
}
void RoundDice::setDiceTexture(){
sf::IntRect diceRect(diceSize*diceResultSix, 0, diceSize, diceSize);
spriteDice.setTextureRect(diceRect);
}
void RoundDice::setColor(int playerNumber){
sf::Color color(DP::playersColors[playerNumber]);
spriteDice.setColor(color);
}
void RoundDice::setDiceTexture(int diceResult){
this->diceResultSix = diceResult;
setDiceTexture();
}
std::string RoundDice::drawRound(){
throwDice();
if (diceResult<33)
{
return "end_of_round_extra_grow";
} else if (diceResult<66)
{
return "end_of_round_extra_energy";
} else
{
// eventExtraCash();
return "end_of_round_extra_cash";
}
return "end_of_round_"+std::to_string(diceResult);
}
int RoundDice::throwDice(){
sfxDice.play();
int result = rand()%100;
diceResult = result;
return result;
}
int RoundDice::throwDiceSix(){
sfxDice.play();
int result = rand()%6;
diceResultSix = result;
setDiceTexture();
// return 26;
return result+1;
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Jun 15, 11:25 PM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
71959
Default Alt Text
(4 KB)

Event Timeline