fixed path stuff

This commit is contained in:
Ralusama19 2017-01-21 12:39:49 +01:00
parent 770739c352
commit a61ff90f8c
4 changed files with 7 additions and 4 deletions

View file

@ -7,7 +7,7 @@ private:
//CONFIG //CONFIG
const double frameTime = 0.2; const double frameTime = 0.2;
const int numFrames = 4; const int numFrames = 4;
const std::string spriteFile = "./Resources/spreadsheet.png"; const std::string spriteFile = WORK_DIR+"Resources/spreadsheet.png";
//POSICIO PLAYER 1 //POSICIO PLAYER 1
float posX1 = 0, posY1 = 250; float posX1 = 0, posY1 = 250;
//POSICIO PLAYER 2 //POSICIO PLAYER 2

View file

@ -23,7 +23,7 @@ void Combat::initShader() {
time = 0; time = 0;
_text.create(W_WIDTH, W_HEIGHT); _text.create(W_WIDTH, W_HEIGHT);
_background.setTexture(_text); _background.setTexture(_text);
_shader.loadFromFile("./Resources/shader.frag", sf::Shader::Fragment); _shader.loadFromFile(WORK_DIR+"Resources/shader.frag", sf::Shader::Fragment);
_shader.setParameter("resolution", sf::Vector2f(W_WIDTH, W_HEIGHT)); _shader.setParameter("resolution", sf::Vector2f(W_WIDTH, W_HEIGHT));
} }

View file

@ -5,6 +5,7 @@
#include <SFML/Window.hpp> #include <SFML/Window.hpp>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include <assert.h> #include <assert.h>
#include <stdlib.h> /* getenv */
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -14,6 +15,8 @@ const int SCENE_NUM = 4;
#define BLACKVALUE 0.00025f #define BLACKVALUE 0.00025f
#define W_WIDTH 800 #define W_WIDTH 800
#define W_HEIGHT 600 #define W_HEIGHT 600
const std::string WORK_DIR(getenv("WORK_DIR"));
#define ASSERT(expression) do \ #define ASSERT(expression) do \
{ \ { \

View file

@ -14,8 +14,8 @@ class Menu : public Scene{
void draw(sf::RenderWindow *window) final override; void draw(sf::RenderWindow *window) final override;
void updateEvents(sf::Event e) final override; void updateEvents(sf::Event e) final override;
private: private:
Button _start = Button("./Resources/play-spreadsheet.png"); Button _start = Button(WORK_DIR+"Resources/play-spreadsheet.png");
Button _exit = Button("./Resources/exit-spreadsheet.png"); Button _exit = Button(WORK_DIR+"Resources/exit-spreadsheet.png");
std::vector<Button*> _buttons; std::vector<Button*> _buttons;
}; };