added PCI interrupt link device
[reactos.git] / rosapps / games / solitaire / solcreate.cpp
1 #include <windows.h>
2 #include <commctrl.h>
3 #include <tchar.h>
4 #include "resource.h"
5 #include "cardlib/cardlib.h"
6
7 #include "solitaire.h"
8
9 const int yBorder = 20;
10 const int xBorder = 20;
11 const int yRowStacks = yBorder + 128;
12
13 CardRegion *pDeck;
14 CardRegion *pPile;
15 CardRegion *pSuitStack[4];
16 CardRegion *pRowStack[NUM_ROW_STACKS];
17
18 extern CardStack activepile;
19
20 HBITMAP hbmBitmap;
21 HDC hdcBitmap;
22
23 void CreateSol()
24 {
25 int i;
26
27 // hbmBitmap = (HBITMAP)LoadImage(0,"test.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
28 // SolWnd.SetBackImage(hbmBitmap);
29
30 activepile.Clear();
31
32
33 pDeck = SolWnd.CreateRegion(DECK_ID, true, xBorder, yBorder, 2, 1);
34 pDeck->SetEmptyImage(CS_EI_SUNK);
35 pDeck->SetThreedCount(6);
36 pDeck->SetDragRule(CS_DRAG_NONE, 0);
37 pDeck->SetDropRule(CS_DROP_NONE, 0);
38 pDeck->SetClickProc(DeckClickProc);
39 pDeck->SetDblClickProc(DeckClickProc);
40 pDeck->SetFaceDirection(CS_FACE_DOWN, 0);
41
42 pPile = SolWnd.CreateRegion(PILE_ID, true, 110, yBorder, CS_DEFXOFF, 1);
43 pPile->SetEmptyImage(CS_EI_NONE);
44 pPile->SetDragRule(CS_DRAG_TOP, 0);
45 pPile->SetDropRule(CS_DROP_NONE, 0);
46 pPile->SetDblClickProc(PileDblClickProc);
47 pPile->SetRemoveCardProc(PileRemoveProc);
48
49 //
50 // Create the suit stacks
51 //
52 for(i = 0; i < 4; i++)
53 {
54 pSuitStack[i] = SolWnd.CreateRegion(SUIT_ID+i, true, 0, yBorder, 0, 0);
55 pSuitStack[i]->SetEmptyImage(CS_EI_SUNK);
56 //pSuitStack[i]->SetPlacement(CS_XJUST_RIGHT, 0, -i * (__cardwidth + 4) - xBorder, 0);
57 pSuitStack[i]->SetPlacement(CS_XJUST_CENTER, 0, i * (__cardwidth + 10) , 0);
58
59 pSuitStack[i]->SetDropRule(CS_DROP_CALLBACK, SuitStackDropProc);
60 pSuitStack[i]->SetDragRule(CS_DRAG_TOP);
61
62 pSuitStack[i]->SetAddCardProc(SuitStackAddProc);
63 }
64
65 //
66 // Create the row stacks
67 //
68 for(i = 0; i < NUM_ROW_STACKS; i++)
69 {
70 pRowStack[i] = SolWnd.CreateRegion(ROW_ID+i, true, 0, yRowStacks, 0, 14);
71 pRowStack[i]->SetEmptyImage(CS_EI_SUNK);
72 pRowStack[i]->SetFaceDirection(CS_FACE_DOWNUP, i);
73
74 pRowStack[i]->SetPlacement(CS_XJUST_CENTER, 0,
75 (i - NUM_ROW_STACKS/2) * (__cardwidth + 10), 0);
76
77 pRowStack[i]->SetEmptyImage(CS_EI_NONE);
78
79 pRowStack[i]->SetDragRule(CS_DRAG_CALLBACK, RowStackDragProc);
80 pRowStack[i]->SetDropRule(CS_DROP_CALLBACK, RowStackDropProc);
81 pRowStack[i]->SetClickProc(RowStackClickProc);
82 pRowStack[i]->SetDblClickProc(RowStackDblClickProc);
83 }
84 }