Educational Game Platform
game2scene.h
Go to the documentation of this file.
1 #ifndef GAME2SCENE_H
2 #define GAME2SCENE_H
3 
4 #include <QObject>
5 #include <QGraphicsScene>
6 #include <QGraphicsPixmapItem>
7 #include <QWidget>
8 #include <QtWidgets>
9 #include <QTimer>
10 #include "card.h"
11 #include "cpu.h"
12 
19 class game2scene : public QGraphicsScene
20 {
21  Q_OBJECT
22 public:
23  explicit game2scene(QObject *parent = 0);
24 
25  CPU *CPU1;
26  CPU *CPU2;
31 
36 
41 
45 
46 
47  QGraphicsPixmapItem *cross;
48  QGraphicsPixmapItem *crossTemp;
49 
50  QGraphicsTextItem *text;
51  QGraphicsTextItem *drawpiletext;
52  QGraphicsTextItem *discardpiletext;
53  QGraphicsTextItem *opp1;
54  QGraphicsTextItem *opp2;
55  QGraphicsPixmapItem *discardPile;
56  QGraphicsPixmapItem *drawPile;
57 
58  QPushButton *goLeft;
59  QPushButton *goRight;
60  QPushButton *takeDiscard;
61  QPushButton *takeDraw;
62  QPushButton *keep;
63  QPushButton *discard;
64  QPushButton *select;
65  QPushButton *callCabo;
66  QPushButton *exitButton;
67 
70 
71  int *firstSelection;
72  int *caboCaller;
73 
74  int *turnsPassed;
75 
76  bool *firstTurn;
77  bool *cputurn;
78  bool *caboCalled;
79 
80  bool *lock;
81 
83 
84 
85  QVector<int> *drawPileCards;
86  QVector<int> *discardPileCards;
87  QString *mystr;
88 
89 // QString *link;
90 
91 signals:
92 
93 public slots:
94 void initUI();
95 void initDrawPile();
96 void initDiscardPile();
97 void initAllCards();
98 void goLeftMove();
99 void goLeftMoveAdv();
100 void goRightMove();
101 void goRightMoveAdv();
115 void checkFinalCabo();
116 void selectPile();
117 void caboCall();
118 void discardAction();
119 void selectandswap_discard();
120 void drawAction();
121 void discardcard_action();
122 void keepcard_action();
124 void checkDrawPile_amount();
126 void gameLoop_main();
127 void cpuTurn();
128 void cpuActions_1();
129 void cpuActions_2();
130 void startCPUGame();
131 void exitgame_n_save();
132 void endgame_exit();
133 void load_game();
134 
135 };
136 
137 #endif // GAME2SCENE_H
game2scene::lock
bool * lock
Temporary lock boolean used to evaluate conditions between functions.
Definition: game2scene.h:80
game2scene::checkFinalCabo
void checkFinalCabo()
game2scene::checkFinalCabo()
Definition: game2scene.cpp:2575
game2scene::endgame_exit
void endgame_exit()
game2scene::endgame_exit()
Definition: game2scene.cpp:2751
game2scene::exitButton
QPushButton * exitButton
Call Cabo and end game.
Definition: game2scene.h:66
game2scene::CPU1Card1
card * CPU1Card1
CPU1 card.
Definition: game2scene.h:32
game2scene::cardSelectionAdversary
int * cardSelectionAdversary
Integer helps with navigation when selecting cards.
Definition: game2scene.h:69
game2scene::CPU1
CPU * CPU1
First CPU opponent.
Definition: game2scene.h:25
game2scene::cross
QGraphicsPixmapItem * cross
Cross symbol used to let the user select cards.
Definition: game2scene.h:47
game2scene::mystr
QString * mystr
String to display on text.
Definition: game2scene.h:87
game2scene::tempPlayerDisplay
card * tempPlayerDisplay
Temporary card to display whenever the player picks from the draw pile and needs to make a choice.
Definition: game2scene.h:44
game2scene::drawPileCards
QVector< int > * drawPileCards
Holds value in the draw pile.
Definition: game2scene.h:85
game2scene::goRightMove
void goRightMove()
game2scene::goRightMove()
Definition: game2scene.cpp:1776
game2scene::checkTwoCards_startPlayer
void checkTwoCards_startPlayer()
game2scene::checkTwoCards_startPlayer()
Definition: game2scene.cpp:1821
game2scene::takeDiscard
QPushButton * takeDiscard
Take from discard pile.
Definition: game2scene.h:60
game2scene::CPU2Card1
card * CPU2Card1
CPU2 card.
Definition: game2scene.h:37
game2scene::playerCard1
card * playerCard1
Player card.
Definition: game2scene.h:27
game2scene::cpuActions_1
void cpuActions_1()
game2scene::cpuActions_1()
Definition: game2scene.cpp:758
game2scene::CPU2Card2
card * CPU2Card2
CPU2 card.
Definition: game2scene.h:38
game2scene::finalScorePlayer
int * finalScorePlayer
Final score of the human player once the game ends.
Definition: game2scene.h:82
game2scene::takeDraw
QPushButton * takeDraw
Take from draw pile.
Definition: game2scene.h:61
game2scene::gameLoop_main
void gameLoop_main()
game2scene::gameLoop_main()
Definition: game2scene.cpp:677
game2scene::caboCalled
bool * caboCalled
Check if cabo has been called.
Definition: game2scene.h:78
game2scene::drawPile
QGraphicsPixmapItem * drawPile
Text element in GUI.
Definition: game2scene.h:56
game2scene::turnsPassed
int * turnsPassed
Check how much turns have passed.
Definition: game2scene.h:74
game2scene::crossTemp
QGraphicsPixmapItem * crossTemp
Second cross symbol used to let the user select cards.
Definition: game2scene.h:48
game2scene::keepcard_action
void keepcard_action()
game2scene::keepcard_action()
Definition: game2scene.cpp:3140
game2scene::checkOneCards_startPlayer
void checkOneCards_startPlayer()
game2scene::checkOneCards_startPlayer()
Definition: game2scene.cpp:1847
game2scene::caboCaller
int * caboCaller
Integer helping check who called cabo.
Definition: game2scene.h:72
game2scene::playerCard4
card * playerCard4
Player card.
Definition: game2scene.h:30
game2scene::spyCard_withenemy_phase3
void spyCard_withenemy_phase3()
game2scene::spyCard_withenemy_phase3()
Definition: game2scene.cpp:2516
game2scene::spyCard_withenemy_phase2
void spyCard_withenemy_phase2()
game2scene::spyCard_withenemy_phase2()
Definition: game2scene.cpp:2450
game2scene::getTwoCards_checkPhase1
void getTwoCards_checkPhase1()
game2scene::getTwoCards_checkPhase1()
Definition: game2scene.cpp:1974
game2scene::swapCard_withenemy_phase3
void swapCard_withenemy_phase3()
game2scene::swapCard_withenemy_phase3()
Definition: game2scene.cpp:2252
game2scene::getTwoCards_checkPhase2
void getTwoCards_checkPhase2()
game2scene::getTwoCards_checkPhase2()
Definition: game2scene.cpp:2029
game2scene::discardpiletext
QGraphicsTextItem * discardpiletext
Text element in GUI.
Definition: game2scene.h:52
game2scene::keep
QPushButton * keep
Keep card picked from draw pile.
Definition: game2scene.h:62
game2scene::cputurn
bool * cputurn
Check if it is the CPU's turn.
Definition: game2scene.h:77
card
Definition: card.h:15
game2scene::discardPile
QGraphicsPixmapItem * discardPile
Text element in GUI.
Definition: game2scene.h:55
CPU
Definition: cpu.h:11
game2scene::CPU1Card2
card * CPU1Card2
CPU1 card.
Definition: game2scene.h:33
game2scene::callCabo
QPushButton * callCabo
Call Cabo and end game.
Definition: game2scene.h:65
game2scene::opp2
QGraphicsTextItem * opp2
Text element in GUI.
Definition: game2scene.h:54
game2scene::initUI
void initUI()
game2scene::initUI()
Definition: game2scene.cpp:342
game2scene::discardPileCard
card * discardPileCard
Discard pile.
Definition: game2scene.h:43
game2scene::cpuActions_2
void cpuActions_2()
game2scene::cpuActions_2()
Definition: game2scene.cpp:1153
game2scene::discardPileCards
QVector< int > * discardPileCards
Holds value in the discard pile.
Definition: game2scene.h:86
game2scene::CPU2
CPU * CPU2
Second CPU opponent.
Definition: game2scene.h:26
game2scene::selectPile
void selectPile()
game2scene::selectPile()
Definition: game2scene.cpp:2863
game2scene::discardcard_action
void discardcard_action()
game2scene::discardcard_action()
Definition: game2scene.cpp:3110
game2scene::discardAction
void discardAction()
game2scene::discardAction()
Definition: game2scene.cpp:2919
game2scene::getOneCards_checkPhase1
void getOneCards_checkPhase1()
game2scene::checkOneCards_checkPhase1()
Definition: game2scene.cpp:1873
game2scene::goRight
QPushButton * goRight
Go left.
Definition: game2scene.h:59
game2scene::drawPileCard
card * drawPileCard
Draw pile.
Definition: game2scene.h:42
game2scene::swapCard_withenemy_phase1
void swapCard_withenemy_phase1()
game2scene::swapCard_withenemy_phase1()
Definition: game2scene.cpp:2168
game2scene::checkDrawPile_amount
void checkDrawPile_amount()
game2scene::checkDrawPile_amount()
Definition: game2scene.cpp:3247
game2scene
Definition: game2scene.h:20
game2scene::getOneCards_checkPhase2
void getOneCards_checkPhase2()
game2scene::getOneCards_checkPhase2()
Definition: game2scene.cpp:1923
game2scene::playerCard3
card * playerCard3
Player card.
Definition: game2scene.h:29
game2scene::keepcard_action_phase1
void keepcard_action_phase1()
game2scene::keepcard_action_phase1()
Definition: game2scene.cpp:3173
game2scene::CPU1Card3
card * CPU1Card3
CPU1 card.
Definition: game2scene.h:34
game2scene::goLeftMove
void goLeftMove()
game2scene::goLeftMove()
Definition: game2scene.cpp:1728
game2scene::exitgame_n_save
void exitgame_n_save()
game2scene::startCPUGame()
Definition: game2scene.cpp:215
game2scene::firstTurn
bool * firstTurn
Check if the game just started.
Definition: game2scene.h:76
game2scene::cardSelection
int * cardSelection
Integer helps with navigation when selecting cards.
Definition: game2scene.h:68
game2scene::initDiscardPile
void initDiscardPile()
game2scene::initDiscardPile()
Definition: game2scene.cpp:472
game2scene::spyCard_withenemy_phase1
void spyCard_withenemy_phase1()
game2scene::spyCard_withenemy_phase1()
Definition: game2scene.cpp:2424
game2scene::selectandswap_discard
void selectandswap_discard()
game2scene::selectandswap_discard()
Definition: game2scene.cpp:2950
game2scene::text
QGraphicsTextItem * text
Text element in GUI.
Definition: game2scene.h:50
game2scene::discard
QPushButton * discard
do not keep picked card from draw pile
Definition: game2scene.h:63
game2scene::goLeftMoveAdv
void goLeftMoveAdv()
game2scene::goLeftMoveAdv()
Definition: game2scene.cpp:1571
game2scene::checkDrawPile_amount_CPUs
void checkDrawPile_amount_CPUs()
game2scene::checkDrawPile_amount_CPUs()
Definition: game2scene.cpp:3294
game2scene::select
QPushButton * select
Select button.
Definition: game2scene.h:64
game2scene::initAllCards
void initAllCards()
game2scene::initAllCards()
Definition: game2scene.cpp:495
game2scene::startCPUGame
void startCPUGame()
game2scene::startCPUGame()
Definition: game2scene.cpp:203
game2scene::cpuTurn
void cpuTurn()
game2scene::cpuTurn()
Definition: game2scene.cpp:1553
game2scene::drawAction
void drawAction()
game2scene::drawAction()
Definition: game2scene.cpp:3025
game2scene::goLeft
QPushButton * goLeft
Go right.
Definition: game2scene.h:58
game2scene::caboCall
void caboCall()
game2scene::caboCall()
Definition: game2scene.cpp:2890
card.h
The card class.
game2scene::load_game
void load_game()
game2scene::load_game()
Definition: game2scene.cpp:90
game2scene::goRightMoveAdv
void goRightMoveAdv()
game2scene::goRightMoveAdv()
Definition: game2scene.cpp:1650
game2scene::drawpiletext
QGraphicsTextItem * drawpiletext
Text element in GUI.
Definition: game2scene.h:51
game2scene::initDrawPile
void initDrawPile()
game2scene::initDrawPile()
Definition: game2scene.cpp:430
game2scene::playerCard2
card * playerCard2
Player card.
Definition: game2scene.h:28
game2scene::CPU2Card4
card * CPU2Card4
CPU2 card.
Definition: game2scene.h:40
game2scene::CPU2Card3
card * CPU2Card3
CPU2 card.
Definition: game2scene.h:39
game2scene::swapCard_withenemy_phase2
void swapCard_withenemy_phase2()
game2scene::swapCard_withenemy_phase2()
Definition: game2scene.cpp:2194
game2scene::CPU1Card4
card * CPU1Card4
CPU1 card.
Definition: game2scene.h:35
game2scene::opp1
QGraphicsTextItem * opp1
Text element in GUI.
Definition: game2scene.h:53
game2scene::getTwoCards_checkPhase3
void getTwoCards_checkPhase3()
game2scene::getTwoCards_checkPhase3()
Definition: game2scene.cpp:2101