added background for menu
This commit is contained in:
parent
c07c2a422e
commit
4f03953e63
5 changed files with 10 additions and 3 deletions
BIN
Resources/Sounds/Fails/1.wav
Normal file
BIN
Resources/Sounds/Fails/1.wav
Normal file
Binary file not shown.
Binary file not shown.
|
@ -35,7 +35,7 @@ void Combat::initShader() {
|
||||||
void Combat::update(float deltaTime, sf::RenderWindow *window) {
|
void Combat::update(float deltaTime, sf::RenderWindow *window) {
|
||||||
player->update(deltaTime, window);
|
player->update(deltaTime, window);
|
||||||
bool aux = enemy->update(deltaTime, window);
|
bool aux = enemy->update(deltaTime, window);
|
||||||
if (ia) enemyManager(aux); //end of player two ia ritm
|
if (ia) enemyManager(aux); //end of player two ia rythm
|
||||||
time += deltaTime;
|
time += deltaTime;
|
||||||
|
|
||||||
_shader.setParameter("time", time);
|
_shader.setParameter("time", time);
|
||||||
|
@ -53,6 +53,7 @@ void Combat::updateEvents(sf::Event e) {
|
||||||
if (playerOneTurn) {
|
if (playerOneTurn) {
|
||||||
bool aux = player->event(e, !attacking);
|
bool aux = player->event(e, !attacking);
|
||||||
if (!aux) { //end of player one ritm
|
if (!aux) { //end of player one ritm
|
||||||
|
|
||||||
if (!attacking) {
|
if (!attacking) {
|
||||||
if(!player->hitBy(enemy->getAttack())) {
|
if(!player->hitBy(enemy->getAttack())) {
|
||||||
scoreEnemy->incrisScore();
|
scoreEnemy->incrisScore();
|
||||||
|
|
|
@ -2,12 +2,15 @@
|
||||||
#include "mygame.hpp"
|
#include "mygame.hpp"
|
||||||
|
|
||||||
Menu::Menu() {
|
Menu::Menu() {
|
||||||
_start.setPosition(5,5);
|
_start.setPosition(512-160,200);
|
||||||
_exit.setPosition(100,100);
|
_exit.setPosition(512-160,400);
|
||||||
_start.turnOn();
|
_start.turnOn();
|
||||||
_exit.turnOn();
|
_exit.turnOn();
|
||||||
_buttons.push_back(&_start);
|
_buttons.push_back(&_start);
|
||||||
_buttons.push_back(&_exit);
|
_buttons.push_back(&_exit);
|
||||||
|
ASSERT(textureBackground.loadFromFile(WORK_DIR+"Resources/background.png"));
|
||||||
|
background.setTexture(textureBackground);
|
||||||
|
background.setPosition(0,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +24,7 @@ void Menu::update(float deltaTime, sf::RenderWindow*window){
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::draw(sf::RenderWindow* window){
|
void Menu::draw(sf::RenderWindow* window){
|
||||||
|
window->draw(background);
|
||||||
for(unsigned int i = 0; i < _buttons.size(); ++i){
|
for(unsigned int i = 0; i < _buttons.size(); ++i){
|
||||||
window->draw(*_buttons[i]);
|
window->draw(*_buttons[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ class Menu : public Scene{
|
||||||
Button _start = Button(WORK_DIR+"Resources/play-spreadsheet.png");
|
Button _start = Button(WORK_DIR+"Resources/play-spreadsheet.png");
|
||||||
Button _exit = Button(WORK_DIR+"Resources/exit-spreadsheet.png");
|
Button _exit = Button(WORK_DIR+"Resources/exit-spreadsheet.png");
|
||||||
std::vector<Button*> _buttons;
|
std::vector<Button*> _buttons;
|
||||||
|
sf::Texture textureBackground;
|
||||||
|
sf::Sprite background;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MENU_HPP
|
#endif // MENU_HPP
|
||||||
|
|
Reference in a new issue