Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
BlackJack.h
Go to the documentation of this file.
1#ifndef BLACKJACK_GAME_H_INCLUDED
2#define BLACKJACK_GAME_H_INCLUDED
3
4#include <vector>
5
6#include <Ult/ModelData.h>
9
10#define WINDOW_NAME "Black Jack"
11#define WINDOW_CLASS "UPGCLASS"
12#define WINDOW_WIDTH 800
13#define WINDOW_HEIGHT 600
14#define WINDOW_FULLSCREEN 0
15
28
39
46
47#define BJ_TOTAL_SUITS 4
48#define BJ_TOTAL_SUIT_CARDS 13
49#define BJ_TOTAL_CARDS BJ_TOTAL_SUITS * BJ_TOTAL_SUIT_CARDS
50
51struct Card
52{
54 int mSuite;
55 int mFace;
56};
57
59{
60public:
62 virtual ~BlackJackGame();
63
64 void Resize(int width, int height);
65
66 virtual bool GameInitialize(Ult::RenderParams& params);
67 virtual void GameUpdate();
68 void GameRender();
69 virtual void GameShutdown();
70
71 virtual int EnterGameLoop() = 0;
72
73protected:
74
76
80
82
85
86 std::vector<int> mPlayerCards;
87 std::vector<int> mCpuCards;
89
92
94
96
98
99 void ProcessMainMenu();
100 void ProcessGameLevel();
101 void DrawCards();
102 void DealCards();
103 int GiveCard();
104 bool IsCardOut(int suite, int face);
105 void ProcessAI();
106 void PlayerHit();
107};
108
109#endif // BLACKJACK_GAME_H_INCLUDED
110
#define BJ_TOTAL_CARDS
Definition BlackJack.h:49
BLACK_JACK_KEYS
Definition BlackJack.h:40
@ BJ_H_KEY
Definition BlackJack.h:42
@ BJ_S_KEY
Definition BlackJack.h:43
@ BJ_ESC_KEY
Definition BlackJack.h:41
@ BJ_TOTAL_KEYS
Definition BlackJack.h:44
BLACK_JACK_GAME_STATE
Definition BlackJack.h:16
@ BJ_GAME_INITIALIZING
Definition BlackJack.h:17
@ BJ_GAME_PLAY_CPU_MOVE
Definition BlackJack.h:22
@ BJ_GAME_PLAY_PLAYER_MOVE
Definition BlackJack.h:21
@ BJ_GAME_PLAY_PLAYER_CPU_TIE
Definition BlackJack.h:25
@ BJ_GAME_PLAY_PLAYER_WIN
Definition BlackJack.h:23
@ BJ_GAME_PLAY_CPU_WIN
Definition BlackJack.h:24
@ BJ_GAME_PLAY_DEALING
Definition BlackJack.h:20
@ BJ_GAME_PLAY_START
Definition BlackJack.h:19
@ BJ_GAME_MENU
Definition BlackJack.h:18
@ BJ_GAME_QUIT
Definition BlackJack.h:26
BLACK_JACK_GUI
Definition BlackJack.h:29
@ BJ_GUI_START
Definition BlackJack.h:31
@ BJ_GUI_MENU
Definition BlackJack.h:30
@ BJ_GUI_CPU_WIN
Definition BlackJack.h:35
@ BJ_GUI_P1_WIN
Definition BlackJack.h:34
@ BJ_GUI_P1_MOVE
Definition BlackJack.h:32
@ BJ_TOTAL_GUI
Definition BlackJack.h:37
@ BJ_GUI_CPU_MOVE
Definition BlackJack.h:33
@ BJ_GUI_P1_CPU_TIE
Definition BlackJack.h:36
void ProcessAI()
Definition BlackJack.cpp:448
bool mQuitDemo
Definition BlackJack.h:97
int mPlayerTotal
Definition BlackJack.h:88
bool mButtonKeys[BJ_TOTAL_KEYS]
Definition BlackJack.h:95
BLACK_JACK_GAME_STATE mCurrentGameState
Definition BlackJack.h:93
bool IsCardOut(int suite, int face)
Definition BlackJack.cpp:432
BlackJackGame()
Definition BlackJack.cpp:12
void GameRender()
Definition BlackJack.cpp:261
Card mCards[BJ_TOTAL_CARDS]
Definition BlackJack.h:78
void Resize(int width, int height)
Definition BlackJack.cpp:36
void DealCards()
Definition BlackJack.cpp:377
Ult::OpenGLRenderer mRender
Definition BlackJack.h:75
void ProcessMainMenu()
Definition BlackJack.cpp:280
virtual void GameUpdate()
Definition BlackJack.cpp:146
Ult::Texture mCardBack
Definition BlackJack.h:79
Ult::Texture mGuiTextures[BJ_TOTAL_GUI]
Definition BlackJack.h:84
void PlayerHit()
Definition BlackJack.cpp:465
bool mCpuStay
Definition BlackJack.h:90
bool mPlayerStay
Definition BlackJack.h:91
void DrawCards()
Definition BlackJack.cpp:341
std::vector< int > mPlayerCards
Definition BlackJack.h:86
int mCpuTotal
Definition BlackJack.h:88
Ult::ModelData mGuiElement
Definition BlackJack.h:83
virtual bool GameInitialize(Ult::RenderParams &params)
Definition BlackJack.cpp:42
Ult::ModelData mBackground
Definition BlackJack.h:81
void ProcessGameLevel()
Definition BlackJack.cpp:289
virtual int EnterGameLoop()=0
virtual ~BlackJackGame()
Definition BlackJack.cpp:31
Ult::ModelData mCardGeometry
Definition BlackJack.h:77
int GiveCard()
Definition BlackJack.cpp:416
std::vector< int > mCpuCards
Definition BlackJack.h:87
virtual void GameShutdown()
Definition BlackJack.cpp:275
Definition ModelData.h:26
Definition OpenGLRenderer.h:23
Handle< stTexture > Texture
Definition Texture.h:10
Definition BlackJack.h:52
int mSuite
Definition BlackJack.h:54
Ult::Texture mDecal
Definition BlackJack.h:53
int mFace
Definition BlackJack.h:55
Definition RenderParams.h:11