1 #include "solitaire.h" 2 3 CardRegion *pDeck; 4 CardRegion *pPile; 5 CardRegion *pSuitStack[4]; 6 CardRegion *pRowStack[NUM_ROW_STACKS]; 7 8 extern CardStack activepile; 9 10 HBITMAP hbmBitmap; 11 HDC hdcBitmap; 12 int yRowStackCardOffset; 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 24 yRowStackCardOffset = (int)(__cardheight / 6.7); 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); 31 pDeck->SetClickProc(DeckClickProc); 32 pDeck->SetDblClickProc(DeckClickProc); 33 pDeck->SetFaceDirection(CS_FACE_DOWN, 0); 34 35 pPile = SolWnd.CreateRegion(PILE_ID, true, X_BORDER + __cardwidth + X_PILE_BORDER, Y_BORDERWITHFRAME, CS_DEFXOFF, 1); 36 pPile->SetEmptyImage(CS_EI_NONE); 37 pPile->SetDragRule(CS_DRAG_TOP, 0); 38 pPile->SetDropRule(CS_DROP_NONE, 0); 39 pPile->SetDblClickProc(PileDblClickProc); 40 pPile->SetRemoveCardProc(PileRemoveProc); 41 pPile->SetClickProc(PileClickProc); 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 52 pSuitStack[i]->SetDropRule(CS_DROP_CALLBACK, SuitStackDropProc); 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 { 64 pRowStack[i] = SolWnd.CreateRegion(ROW_ID+i, true, 0, Y_BORDERWITHFRAME + __cardheight + Y_ROWSTACK_BORDER, 0, yRowStackCardOffset); 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 73 pRowStack[i]->SetDragRule(CS_DRAG_CALLBACK, RowStackDragProc); 74 pRowStack[i]->SetDropRule(CS_DROP_CALLBACK, RowStackDropProc); 75 pRowStack[i]->SetClickProc(RowStackClickProc); 76 pRowStack[i]->SetDblClickProc(RowStackDblClickProc); 77 } 78 } 79