Reactos
at master 121 lines 2.7 kB view raw
1// 2// CardLib - not much of interest in here 3// 4// Freeware 5// Copyright J Brown 2001 6// 7 8#include "cardlib.h" 9 10void LoadCardBitmaps(void); 11 12//static bool __CARDLIB_ACES_HIGH = false; 13extern double __CARDZOOMSPEED; 14 15// 16// Global variables! 17// 18HDC __hdcCardBitmaps; 19HBITMAP __hbmCardBitmaps; 20 21HDC __hdcPlaceHolder; 22HBITMAP __hbmPlaceHolder; 23HPALETTE __holdplacepal; 24 25int __cardwidth; 26int __cardheight; 27 28HPALETTE __hPalette; 29 30 31// 32// Cardlib global functions! 33// 34void 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/* 52void CardLib_SetAcesHigh(bool fHigh); 53bool operator != (const Card &lhs, const Card &rhs); 54bool operator == (const Card &lhs, const Card &rhs); 55bool operator < (const Card &lhs, const Card &rhs); 56bool operator <= (const Card &lhs, const Card &rhs); 57bool operator > (const Card &lhs, const Card &rhs); 58bool operator >= (const Card &lhs, const Card &rhs); 59*/ 60 61/* 62void CardLib_SetAcesHigh(bool fHigh) 63{ 64 __CARDLIB_ACES_HIGH = fHigh; 65} 66 67bool 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 75bool 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 83bool 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 91bool 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 99bool 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 107bool 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 116void 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}