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