Merge branch 'master' into serk
This commit is contained in:
commit
ac2f53a8a8
11 changed files with 38 additions and 14 deletions
|
@ -26,16 +26,16 @@ void Character::update(float deltaTime){
|
||||||
timestamp += deltaTime;
|
timestamp += deltaTime;
|
||||||
if (timestamp >= frameTime){
|
if (timestamp >= frameTime){
|
||||||
timestamp = 0;
|
timestamp = 0;
|
||||||
|
sf::IntRect rect = sf::IntRect(indexX*width, indexY*height, width, height);
|
||||||
|
setTextureRect(rect);
|
||||||
|
|
||||||
|
//Acabar automaticament la animacio de attack
|
||||||
if (actualState == PlayerState::attacking and indexX >= 3){
|
if (actualState == PlayerState::attacking and indexX >= 3){
|
||||||
setState(PlayerState::idle);
|
setState(PlayerState::idle);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
indexX = (indexX+1)%4;
|
indexX = (indexX+1)%4;
|
||||||
}
|
}
|
||||||
|
|
||||||
sf::IntRect rect = sf::IntRect(indexX*width, indexY*height, width, height);
|
|
||||||
setTextureRect(rect);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
class Character : public sf::Sprite{
|
class Character : public sf::Sprite{
|
||||||
private:
|
private:
|
||||||
//CONFIG
|
//CONFIG
|
||||||
const double frameTime = 0.2;
|
const double frameTime = 0.15;
|
||||||
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
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 \
|
||||||
{ \
|
{ \
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
QMAKE_DEFAULT_INCDIRS = \
|
||||||
|
/usr/include/c++/6 \
|
||||||
|
/usr/include/x86_64-linux-gnu/c++/6 \
|
||||||
|
/usr/include/c++/6/backward \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/6/include \
|
||||||
|
/usr/local/include \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed \
|
||||||
|
/usr/include/x86_64-linux-gnu \
|
||||||
|
/usr/include
|
||||||
|
QMAKE_DEFAULT_LIBDIRS = \
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/6 \
|
||||||
|
/usr/lib/x86_64-linux-gnu \
|
||||||
|
/usr/lib \
|
||||||
|
/lib/x86_64-linux-gnu \
|
||||||
|
/lib
|
|
@ -203,7 +203,6 @@ DIST = ../../../Qt/5.7/gcc_64/mkspecs/features/spec_pre.prf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/qt_config.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/qt_config.prf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/linux-g++/qmake.conf \
|
../../../Qt/5.7/gcc_64/mkspecs/linux-g++/qmake.conf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/spec_post.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/spec_post.prf \
|
||||||
../VaporWaveWars/.qmake.stash \
|
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/exclusive_builds.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/exclusive_builds.prf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/default_pre.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/default_pre.prf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/resolve_config.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/resolve_config.prf \
|
||||||
|
@ -380,7 +379,6 @@ Makefile: ../VaporWaveWars/VaporWaveWars.pro ../../../Qt/5.7/gcc_64/mkspecs/linu
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/qt_config.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/qt_config.prf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/linux-g++/qmake.conf \
|
../../../Qt/5.7/gcc_64/mkspecs/linux-g++/qmake.conf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/spec_post.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/spec_post.prf \
|
||||||
.qmake.stash \
|
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/exclusive_builds.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/exclusive_builds.prf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/default_pre.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/default_pre.prf \
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/resolve_config.prf \
|
../../../Qt/5.7/gcc_64/mkspecs/features/resolve_config.prf \
|
||||||
|
@ -525,7 +523,6 @@ Makefile: ../VaporWaveWars/VaporWaveWars.pro ../../../Qt/5.7/gcc_64/mkspecs/linu
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/qt_config.prf:
|
../../../Qt/5.7/gcc_64/mkspecs/features/qt_config.prf:
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/linux-g++/qmake.conf:
|
../../../Qt/5.7/gcc_64/mkspecs/linux-g++/qmake.conf:
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/spec_post.prf:
|
../../../Qt/5.7/gcc_64/mkspecs/features/spec_post.prf:
|
||||||
.qmake.stash:
|
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/exclusive_builds.prf:
|
../../../Qt/5.7/gcc_64/mkspecs/features/exclusive_builds.prf:
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/default_pre.prf:
|
../../../Qt/5.7/gcc_64/mkspecs/features/default_pre.prf:
|
||||||
../../../Qt/5.7/gcc_64/mkspecs/features/resolve_config.prf:
|
../../../Qt/5.7/gcc_64/mkspecs/features/resolve_config.prf:
|
||||||
|
@ -591,6 +588,7 @@ main.o: ../VaporWaveWars/main.cpp ../VaporWaveWars/mygame.hpp \
|
||||||
../VaporWaveWars/compas.hpp \
|
../VaporWaveWars/compas.hpp \
|
||||||
../VaporWaveWars/player.hpp \
|
../VaporWaveWars/player.hpp \
|
||||||
../VaporWaveWars/actor.hpp \
|
../VaporWaveWars/actor.hpp \
|
||||||
|
../VaporWaveWars/character.hpp \
|
||||||
../VaporWaveWars/iaenemy.hpp
|
../VaporWaveWars/iaenemy.hpp
|
||||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../VaporWaveWars/main.cpp
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../VaporWaveWars/main.cpp
|
||||||
|
|
||||||
|
@ -608,6 +606,7 @@ mygame.o: ../VaporWaveWars/mygame.cpp ../VaporWaveWars/mygame.hpp \
|
||||||
../VaporWaveWars/compas.hpp \
|
../VaporWaveWars/compas.hpp \
|
||||||
../VaporWaveWars/player.hpp \
|
../VaporWaveWars/player.hpp \
|
||||||
../VaporWaveWars/actor.hpp \
|
../VaporWaveWars/actor.hpp \
|
||||||
|
../VaporWaveWars/character.hpp \
|
||||||
../VaporWaveWars/iaenemy.hpp
|
../VaporWaveWars/iaenemy.hpp
|
||||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mygame.o ../VaporWaveWars/mygame.cpp
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mygame.o ../VaporWaveWars/mygame.cpp
|
||||||
|
|
||||||
|
@ -638,6 +637,7 @@ menu.o: ../VaporWaveWars/menu.cpp ../VaporWaveWars/menu.hpp \
|
||||||
../VaporWaveWars/compas.hpp \
|
../VaporWaveWars/compas.hpp \
|
||||||
../VaporWaveWars/player.hpp \
|
../VaporWaveWars/player.hpp \
|
||||||
../VaporWaveWars/actor.hpp \
|
../VaporWaveWars/actor.hpp \
|
||||||
|
../VaporWaveWars/character.hpp \
|
||||||
../VaporWaveWars/iaenemy.hpp
|
../VaporWaveWars/iaenemy.hpp
|
||||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o menu.o ../VaporWaveWars/menu.cpp
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o menu.o ../VaporWaveWars/menu.cpp
|
||||||
|
|
||||||
|
@ -648,22 +648,28 @@ combat.o: ../VaporWaveWars/combat.cpp ../VaporWaveWars/combat.hpp \
|
||||||
../VaporWaveWars/game.hpp \
|
../VaporWaveWars/game.hpp \
|
||||||
../VaporWaveWars/player.hpp \
|
../VaporWaveWars/player.hpp \
|
||||||
../VaporWaveWars/actor.hpp \
|
../VaporWaveWars/actor.hpp \
|
||||||
|
../VaporWaveWars/character.hpp \
|
||||||
../VaporWaveWars/iaenemy.hpp
|
../VaporWaveWars/iaenemy.hpp
|
||||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o combat.o ../VaporWaveWars/combat.cpp
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o combat.o ../VaporWaveWars/combat.cpp
|
||||||
|
|
||||||
player.o: ../VaporWaveWars/player.cpp ../VaporWaveWars/player.hpp \
|
player.o: ../VaporWaveWars/player.cpp ../VaporWaveWars/player.hpp \
|
||||||
../VaporWaveWars/commons.hpp \
|
../VaporWaveWars/commons.hpp \
|
||||||
../VaporWaveWars/compas.hpp \
|
../VaporWaveWars/compas.hpp \
|
||||||
../VaporWaveWars/actor.hpp
|
../VaporWaveWars/actor.hpp \
|
||||||
|
../VaporWaveWars/character.hpp
|
||||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o player.o ../VaporWaveWars/player.cpp
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o player.o ../VaporWaveWars/player.cpp
|
||||||
|
|
||||||
iaenemy.o: ../VaporWaveWars/iaenemy.cpp ../VaporWaveWars/iaenemy.hpp \
|
iaenemy.o: ../VaporWaveWars/iaenemy.cpp ../VaporWaveWars/iaenemy.hpp \
|
||||||
../VaporWaveWars/actor.hpp \
|
../VaporWaveWars/actor.hpp \
|
||||||
../VaporWaveWars/commons.hpp
|
../VaporWaveWars/commons.hpp \
|
||||||
|
../VaporWaveWars/character.hpp \
|
||||||
|
../VaporWaveWars/compas.hpp
|
||||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o iaenemy.o ../VaporWaveWars/iaenemy.cpp
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o iaenemy.o ../VaporWaveWars/iaenemy.cpp
|
||||||
|
|
||||||
actor.o: ../VaporWaveWars/actor.cpp ../VaporWaveWars/actor.hpp \
|
actor.o: ../VaporWaveWars/actor.cpp ../VaporWaveWars/actor.hpp \
|
||||||
../VaporWaveWars/commons.hpp
|
../VaporWaveWars/commons.hpp \
|
||||||
|
../VaporWaveWars/character.hpp \
|
||||||
|
../VaporWaveWars/compas.hpp
|
||||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o actor.o ../VaporWaveWars/actor.cpp
|
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o actor.o ../VaporWaveWars/actor.cpp
|
||||||
|
|
||||||
####### Install
|
####### Install
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
Reference in a new issue