ReactOS 0.4.15-dev-8102-g108db8f
Card Class Reference

#include <card.h>

Collaboration diagram for Card:

Public Member Functions

 Card ()
 
 Card (int value, int suit)
 
 Card (int index)
 
int Suit () const
 
int LoVal () const
 
int HiVal () const
 
int Idx () const
 
bool FaceUp () const
 
bool FaceDown () const
 
void SetFaceUp (bool fTrue)
 
bool IsBlack () const
 
bool IsRed () const
 

Private Attributes

int nValue
 
bool fFaceUp
 

Friends

class CardStack
 

Detailed Description

Definition at line 27 of file card.h.

Constructor & Destructor Documentation

◆ Card() [1/3]

Card::Card ( )
inline

Definition at line 33 of file card.h.

34 {
35 nValue = 0; //ace of spades by default
36 fFaceUp = true;
37 }
bool fFaceUp
Definition: card.h:102
int nValue
Definition: card.h:101

◆ Card() [2/3]

Card::Card ( int  value,
int  suit 
)
inline

Definition at line 39 of file card.h.

40 {
41 nValue = MAKE_CARD(value, suit);
42 fFaceUp = true;
43 }
int MAKE_CARD(int Value, int Suit)
Definition: card.h:15
Definition: pdh_main.c:94

◆ Card() [3/3]

Card::Card ( int  index)
inline

Definition at line 45 of file card.h.

46 {
47 if(index < 0) index = 0;
48 if(index > 51) index = 51;
49
50 nValue = index;
51 fFaceUp = true;
52 }
#define index(s, c)
Definition: various.h:29
GLuint index
Definition: glext.h:6031

Member Function Documentation

◆ FaceDown()

bool Card::FaceDown ( ) const
inline

Definition at line 79 of file card.h.

80 {
81 return !fFaceUp;
82 }

Referenced by CardRegion::Render().

◆ FaceUp()

bool Card::FaceUp ( ) const
inline

Definition at line 74 of file card.h.

75 {
76 return fFaceUp;
77 }

Referenced by CardRegion::PrepareDragBitmaps(), and CardRegion::PrepareDragBitmapsThreed().

◆ HiVal()

int Card::HiVal ( ) const
inline

Definition at line 64 of file card.h.

65 {
66 return ((nValue < 4) ? 14 : (nValue / 4) + 1);
67 }

◆ Idx()

int Card::Idx ( ) const
inline

Definition at line 69 of file card.h.

70 {
71 return nValue;
72 }

Referenced by CardRegion::PrepareDragBitmaps(), CardRegion::PrepareDragBitmapsThreed(), and CardRegion::Render().

◆ IsBlack()

bool Card::IsBlack ( ) const
inline

Definition at line 89 of file card.h.

90 {
91 return Suit() == 0 || Suit() == 3;
92 }
int Suit() const
Definition: card.h:54

Referenced by IsRed().

◆ IsRed()

bool Card::IsRed ( ) const
inline

Definition at line 94 of file card.h.

95 {
96 return !IsBlack();
97 }
bool IsBlack() const
Definition: card.h:89

Referenced by RowStackDropProc().

◆ LoVal()

int Card::LoVal ( ) const
inline

Definition at line 59 of file card.h.

60 {
61 return (nValue / 4) + 1;
62 }

Referenced by CardCount::Add(), CanDrop(), RowStackDropProc(), StackDropProc(), and CardCount::Sub().

◆ SetFaceUp()

void Card::SetFaceUp ( bool  fTrue)
inline

Definition at line 84 of file card.h.

85 {
86 fFaceUp = fTrue;
87 }

◆ Suit()

int Card::Suit ( ) const
inline

Definition at line 54 of file card.h.

55 {
56 return (nValue % 4);
57 }

Referenced by CanDrop(), IsBlack(), and StackDropProc().

Friends And Related Function Documentation

◆ CardStack

friend class CardStack
friend

Definition at line 29 of file card.h.

Member Data Documentation

◆ fFaceUp

bool Card::fFaceUp
private

Definition at line 102 of file card.h.

Referenced by Card(), FaceDown(), FaceUp(), and SetFaceUp().

◆ nValue

int Card::nValue
private

Definition at line 101 of file card.h.

Referenced by Card(), HiVal(), Idx(), LoVal(), and Suit().


The documentation for this class was generated from the following file: