ReactOS  0.4.11-dev-946-g431643b
solcreate.cpp
Go to the documentation of this file.
1 #include "solitaire.h"
2 
7 
8 extern CardStack activepile;
9 
13 
14 void CreateSol()
15 {
16  int i;
17 
18 // hbmBitmap = (HBITMAP)LoadImage(0,"test.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
19 // SolWnd.SetBackImage(hbmBitmap);
20 
21  activepile.Clear();
22 
23  // Compute the value for yRowStackCardOffset based on the height of the card, so the card number isn't hidden on larger cards
25 
26  pDeck = SolWnd.CreateRegion(DECK_ID, true, X_BORDER, Y_BORDERWITHFRAME, 2, 1);
27  pDeck->SetEmptyImage(CS_EI_CIRC);
28  pDeck->SetThreedCount(6);
29  pDeck->SetDragRule(CS_DRAG_NONE, 0);
30  pDeck->SetDropRule(CS_DROP_NONE, 0);
33  pDeck->SetFaceDirection(CS_FACE_DOWN, 0);
34 
36  pPile->SetEmptyImage(CS_EI_NONE);
37  pPile->SetDragRule(CS_DRAG_TOP, 0);
38  pPile->SetDropRule(CS_DROP_NONE, 0);
42 
43  //
44  // Create the suit stacks
45  //
46  for(i = 0; i < 4; i++)
47  {
48  pSuitStack[i] = SolWnd.CreateRegion(SUIT_ID+i, true, 0, Y_BORDERWITHFRAME, 0, 0);
49  pSuitStack[i]->SetEmptyImage(CS_EI_SUNK);
50  pSuitStack[i]->SetPlacement(CS_XJUST_CENTER, 0, i * (__cardwidth + X_SUITSTACK_BORDER) , 0);
51 
53  pSuitStack[i]->SetDragRule(CS_DRAG_TOP);
54  pSuitStack[i]->SetClickProc(SuitStackClickProc);
55 
56  pSuitStack[i]->SetAddCardProc(SuitStackAddProc);
57  }
58 
59  //
60  // Create the row stacks
61  //
62  for(i = 0; i < NUM_ROW_STACKS; i++)
63  {
65  pRowStack[i]->SetEmptyImage(CS_EI_SUNK);
66  pRowStack[i]->SetFaceDirection(CS_FACE_DOWNUP, i);
67 
68  pRowStack[i]->SetPlacement(CS_XJUST_CENTER, 0,
69  (i - NUM_ROW_STACKS/2) * (__cardwidth + X_ROWSTACK_BORDER), 0);
70 
71  pRowStack[i]->SetEmptyImage(CS_EI_NONE);
72 
75  pRowStack[i]->SetClickProc(RowStackClickProc);
77  }
78 }
#define HDC
Definition: msvc.h:22
bool CARDLIBPROC SuitStackDropProc(CardRegion &stackobj, CardStack &dragcards)
Definition: solgame.cpp:230
void CARDLIBPROC PileRemoveProc(CardRegion &stackobj, int iItems)
Definition: solgame.cpp:456
void SetFaceDirection(UINT uDirType, int nOption)
Definition: cardregion.cpp:258
#define HBITMAP
Definition: msvc.h:28
void CARDLIBPROC SuitStackAddProc(CardRegion &stackobj, const CardStack &added)
Definition: solgame.cpp:338
CardStack activepile
Definition: solgame.cpp:12
#define X_BORDER
Definition: solitaire.h:49
HDC hdcBitmap
Definition: solcreate.cpp:11
#define SUIT_ID
Definition: solitaire.h:41
bool CARDLIBPROC RowStackDropProc(CardRegion &stackobj, CardStack &dragcards)
Definition: solgame.cpp:125
#define CS_DRAG_NONE
Definition: cardlib.h:28
#define CS_DRAG_CALLBACK
Definition: cardlib.h:31
#define CS_EI_SUNK
Definition: cardlib.h:19
void Clear()
Definition: cardstack.cpp:37
int yRowStackCardOffset
Definition: solcreate.cpp:12
void SetPlacement(UINT xJustify, UINT yJustify, int xAdjust, int yAdjust)
Definition: cardregion.cpp:250
CardRegion * pDeck
Definition: solcreate.cpp:3
CardRegion * pSuitStack[4]
Definition: solcreate.cpp:5
void CreateSol()
Definition: solcreate.cpp:14
#define Y_ROWSTACK_BORDER
Definition: solitaire.h:55
void CARDLIBPROC SuitStackClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:269
void CARDLIBPROC RowStackClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:284
void SetDblClickProc(pClickProc proc)
Definition: cardregion.cpp:192
#define DECK_ID
Definition: solitaire.h:39
#define CS_EI_NONE
Definition: cardlib.h:18
#define ROW_ID
Definition: solitaire.h:42
void SetEmptyImage(UINT uImage)
Definition: cardregion.cpp:366
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define CS_EI_CIRC
Definition: cardlib.h:20
bool SetThreedCount(int count)
Definition: cardregion.cpp:215
#define Y_BORDERWITHFRAME
Definition: solitaire.h:54
HBITMAP hbmBitmap
Definition: solcreate.cpp:10
#define X_ROWSTACK_BORDER
Definition: solitaire.h:51
bool SetDragRule(UINT uDragType, pCanDragProc proc=0)
Definition: cardregion.cpp:146
#define X_SUITSTACK_BORDER
Definition: solitaire.h:52
#define CS_XJUST_CENTER
Definition: cardlib.h:39
#define PILE_ID
Definition: solitaire.h:40
#define NUM_ROW_STACKS
Definition: solitaire.h:38
#define CS_FACE_DOWN
Definition: cardlib.h:52
void CARDLIBPROC DeckClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:482
void CARDLIBPROC RowStackDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:394
#define CS_DRAG_TOP
Definition: cardlib.h:29
#define CS_DEFXOFF
Definition: cardlib.h:23
#define CS_DROP_NONE
Definition: cardlib.h:33
void CARDLIBPROC PileClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:429
CardRegion * CreateRegion(int id, bool fVisible, int x, int y, int xoffset, int yoffset)
Definition: cardregion.cpp:104
void SetClickProc(pClickProc proc)
Definition: cardregion.cpp:182
int __cardwidth
Definition: cardlib.cpp:25
#define CS_DROP_CALLBACK
Definition: cardlib.h:35
#define CS_FACE_DOWNUP
Definition: cardlib.h:53
void CARDLIBPROC PileDblClickProc(CardRegion &stackobj, int iNumClicked)
Definition: solgame.cpp:443
#define X_PILE_BORDER
Definition: solitaire.h:50
void SetAddCardProc(pAddProc proc)
Definition: cardregion.cpp:197
void SetRemoveCardProc(pRemoveProc proc)
Definition: cardregion.cpp:202
bool SetDropRule(UINT uDropType, pCanDropProc proc=0)
Definition: cardregion.cpp:164
int __cardheight
Definition: cardlib.cpp:26
CardRegion * pRowStack[NUM_ROW_STACKS]
Definition: solcreate.cpp:6
bool CARDLIBPROC RowStackDragProc(CardRegion &stackobj, int iNumDragCards)
Definition: solgame.cpp:101
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29
CardWindow SolWnd
Definition: solitaire.cpp:32
CardRegion * pPile
Definition: solcreate.cpp:4