Repository navigation
Expand file tree
/
Copy pathSplash.cpp
More file actions
58 lines (53 loc) · 2.03 KB
/
Copy pathSplash.cpp
File metadata and controls
58 lines (53 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "Splash.h"
Splash::Splash(){
//Splash BG
if (!bgImage.loadFromFile("DATA/MISC/splashbg.png")){
//error...
}
if (!bgTexture.loadFromImage(bgImage, sf::IntRect(0, 0, 1280, 800))){
//error...
}
bgSprite.setTexture(bgTexture);
choiceWidth = 325;
choiceHeight = 43;
//Start Game
startChoice.id = "STARTGAME";
if (!startChoice.texture.loadFromFile(("DATA/MISC/start.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight)) ||
!startChoice.textureActive.loadFromFile(("DATA/MISC/starta.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight))){
//error...
}
startChoice.sprite.setTexture(startChoice.texture);
startChoice.active = false;
choices.push_back(&startChoice);
//ManageDeck
manageDeckChoice.id = "MANAGEDECK";
if (!manageDeckChoice.texture.loadFromFile(("DATA/MISC/managedeck.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight)) ||
!manageDeckChoice.textureActive.loadFromFile(("DATA/MISC/managedecka.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight))){
//error...
}
manageDeckChoice.sprite.setTexture(manageDeckChoice.texture);
manageDeckChoice.active = false;
choices.push_back(&manageDeckChoice);
//Options
optionsChoice.id = "OPTIONS";
if (!optionsChoice.texture.loadFromFile(("DATA/MISC/options.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight)) ||
!optionsChoice.textureActive.loadFromFile(("DATA/MISC/optionsa.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight))){
//error...
}
optionsChoice.sprite.setTexture(optionsChoice.texture);
choices.push_back(&optionsChoice);
//Exit Game
exitChoice.id = "EXITGAME";
if (!exitChoice.texture.loadFromFile(("DATA/MISC/exit.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight)) ||
!exitChoice.textureActive.loadFromFile(("DATA/MISC/exita.png"), sf::IntRect(0, 0, choiceWidth, choiceHeight))){
//error...
}
exitChoice.sprite.setTexture(exitChoice.texture);
choices.push_back(&exitChoice);
//Set positions
for (unsigned int i = 0; i < choices.size(); i++){
choices[i]->sprite.setPosition(sf::Vector2f(450, 400 + i * (choiceHeight + 10)));
}
}
Splash::~Splash(){
}