- Update to r53061
[reactos.git] / base / applications / games / solitaire / solcreate.cpp
1
2 #include "solitaire.h"
3
4 CardRegion *pDeck;
5 CardRegion *pPile;
6 CardRegion *pSuitStack[4];
7 CardRegion *pRowStack[NUM_ROW_STACKS];
8
9 extern CardStack activepile;
10
11 HBITMAP hbmBitmap;
12 HDC hdcBitmap;
13 int yRowStackCardOffset;
14
15 void CreateSol()
16 {
17 int i;
18
19 // hbmBitmap = (HBITMAP)LoadImage(0,"test.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
20 // SolWnd.SetBackImage(hbmBitmap);
21
22 activepile.Clear();
23
24 // Compute the value for yRowStackCardOffset based on the height of the card, so the card number isn't hidden on larger cards
25 yRowStackCardOffset = (int)(__cardheight / 6.7);
26
27 pDeck = SolWnd.CreateRegion(DECK_ID, true, X_BORDER, Y_BORDER, 2, 1);
28 pDeck->SetEmptyImage(CS_EI_CIRC);
29 pDeck->SetThreedCount(6);
30 pDeck->SetDragRule(CS_DRAG_NONE, 0);
31 pDeck->SetDropRule(CS_DROP_NONE, 0);
32 pDeck->SetClickProc(DeckClickProc);
33 pDeck->SetDblClickProc(DeckClickProc);
34 pDeck->SetFaceDirection(CS_FACE_DOWN, 0);
35
36 pPile = SolWnd.CreateRegion(PILE_ID, true, X_BORDER + __cardwidth + X_PILE_BORDER, Y_BORDER, CS_DEFXOFF, 1);
37 pPile->SetEmptyImage(CS_EI_NONE);
38 pPile->SetDragRule(CS_DRAG_TOP, 0);
39 pPile->SetDropRule(CS_DROP_NONE, 0);
40 pPile->SetDblClickProc(PileDblClickProc);
41 pPile->SetRemoveCardProc(PileRemoveProc);
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_BORDER, 0, 0);
49 pSuitStack[i]->SetEmptyImage(CS_EI_SUNK);
50 pSuitStack[i]->SetPlacement(CS_XJUST_CENTER, 0, i * (__cardwidth + X_SUITSTACK_BORDER) , 0);
51
52 pSuitStack[i]->SetDropRule(CS_DROP_CALLBACK, SuitStackDropProc);
53 pSuitStack[i]->SetDragRule(CS_DRAG_TOP);
54
55 pSuitStack[i]->SetAddCardProc(SuitStackAddProc);
56 }
57
58 //
59 // Create the row stacks
60 //
61 for(i = 0; i < NUM_ROW_STACKS; i++)
62 {
63 pRowStack[i] = SolWnd.CreateRegion(ROW_ID+i, true, 0, Y_BORDER + __cardheight + Y_ROWSTACK_BORDER, 0, yRowStackCardOffset);
64 pRowStack[i]->SetEmptyImage(CS_EI_SUNK);
65 pRowStack[i]->SetFaceDirection(CS_FACE_DOWNUP, i);
66
67 pRowStack[i]->SetPlacement(CS_XJUST_CENTER, 0,
68 (i - NUM_ROW_STACKS/2) * (__cardwidth + X_ROWSTACK_BORDER), 0);
69
70 pRowStack[i]->SetEmptyImage(CS_EI_NONE);
71
72 pRowStack[i]->SetDragRule(CS_DRAG_CALLBACK, RowStackDragProc);
73 pRowStack[i]->SetDropRule(CS_DROP_CALLBACK, RowStackDropProc);
74 pRowStack[i]->SetClickProc(RowStackClickProc);
75 pRowStack[i]->SetDblClickProc(RowStackDblClickProc);
76 }
77 }