1 // 2 // CardLib - not much of interest in here 3 // 4 // Freeware 5 // Copyright J Brown 2001 6 // 7 8 #include "cardlib.h" 9 10 void LoadCardBitmaps(void); 11 12 //static bool __CARDLIB_ACES_HIGH = false; 13 extern double __CARDZOOMSPEED; 14 15 // 16 // Global variables! 17 // 18 HDC __hdcCardBitmaps; 19 HBITMAP __hbmCardBitmaps; 20 21 HDC __hdcPlaceHolder; 22 HBITMAP __hbmPlaceHolder; 23 HPALETTE __holdplacepal; 24 25 int __cardwidth; 26 int __cardheight; 27 28 HPALETTE __hPalette; 29 30 31 // 32 // Cardlib global functions! 33 // 34 void CardLib_SetZoomSpeed(int speed) 35 { 36 __CARDZOOMSPEED = (double)speed; 37 } 38 39 /* 40 41 It's dangerous to use these operators, because of all 42 the implicit conversions that could take place, which 43 would have unpredicted side-effects. 44 45 e.g. Card card(Hearts, 4); 46 if(card == 4) - how does 4 get converted?? 47 It uses the Card(int uval) constructor, 48 which results in a 2 of clubs... 49 not what was expected 50 */ 51 /* 52 void CardLib_SetAcesHigh(bool fHigh); 53 bool operator != (const Card &lhs, const Card &rhs); 54 bool operator == (const Card &lhs, const Card &rhs); 55 bool operator < (const Card &lhs, const Card &rhs); 56 bool operator <= (const Card &lhs, const Card &rhs); 57 bool operator > (const Card &lhs, const Card &rhs); 58 bool operator >= (const Card &lhs, const Card &rhs); 59 */ 60 61 /* 62 void CardLib_SetAcesHigh(bool fHigh) 63 { 64 __CARDLIB_ACES_HIGH = fHigh; 65 } 66 67 bool operator == (const Card &lhs, const Card &rhs) 68 { 69 if(__CARDLIB_ACES_HIGH) 70 return lhs.HiVal() == rhs.HiVal(); 71 else 72 return lhs.LoVal() == rhs.LoVal(); 73 } 74 75 bool operator != (const Card &lhs, const Card &rhs) 76 { 77 if(__CARDLIB_ACES_HIGH) 78 return lhs.HiVal() != rhs.HiVal(); 79 else 80 return lhs.LoVal() != rhs.LoVal(); 81 } 82 83 bool operator > (const Card &lhs, const Card &rhs) 84 { 85 if(__CARDLIB_ACES_HIGH) 86 return lhs.HiVal() > rhs.HiVal(); 87 else 88 return lhs.LoVal() > rhs.LoVal(); 89 } 90 91 bool operator >= (const Card &lhs, const Card &rhs) 92 { 93 if(__CARDLIB_ACES_HIGH) 94 return lhs.HiVal() >= rhs.HiVal(); 95 else 96 return lhs.LoVal() >= rhs.LoVal(); 97 } 98 99 bool operator < (const Card &lhs, const Card &rhs) 100 { 101 if(__CARDLIB_ACES_HIGH) 102 return lhs.HiVal() < rhs.HiVal(); 103 else 104 return lhs.LoVal() < rhs.LoVal(); 105 } 106 107 bool operator <= (const Card &lhs, const Card &rhs) 108 { 109 if(__CARDLIB_ACES_HIGH) 110 return lhs.HiVal() <= rhs.HiVal(); 111 else 112 return lhs.LoVal() <= rhs.LoVal(); 113 } 114 */ 115 116 void PaintRect(HDC hdc, RECT *rect, COLORREF colour) 117 { 118 COLORREF oldcr = SetBkColor(hdc, colour); 119 ExtTextOut(hdc, 0, 0, ETO_OPAQUE, rect, TEXT(""), 0, 0); 120 SetBkColor(hdc, oldcr); 121 } 122