Compute the card offset for the row stack based on the height of the card.

Otherwise the numbers of larger cards (like in cardsbav) are not visible.

svn path=/trunk/; revision=29573
This commit is contained in:
Colin Finck 2007-10-14 19:49:12 +00:00
parent 5c9cfdf1ff
commit 32bb43598d
3 changed files with 10 additions and 7 deletions

View file

@ -15,6 +15,7 @@ extern CardStack activepile;
HBITMAP hbmBitmap; HBITMAP hbmBitmap;
HDC hdcBitmap; HDC hdcBitmap;
int yRowStackCardOffset;
void CreateSol() void CreateSol()
{ {
@ -25,6 +26,8 @@ void CreateSol()
activepile.Clear(); activepile.Clear();
// Compute the value for yRowStackCardOffset based on the height of the card, so the card number isn't hidden on larger cards
yRowStackCardOffset = __cardheight / 6.7;
pDeck = SolWnd.CreateRegion(DECK_ID, true, X_BORDER, Y_BORDER, 2, 1); pDeck = SolWnd.CreateRegion(DECK_ID, true, X_BORDER, Y_BORDER, 2, 1);
pDeck->SetEmptyImage(CS_EI_SUNK); pDeck->SetEmptyImage(CS_EI_SUNK);
@ -62,7 +65,7 @@ void CreateSol()
// //
for(i = 0; i < NUM_ROW_STACKS; i++) for(i = 0; i < NUM_ROW_STACKS; i++)
{ {
pRowStack[i] = SolWnd.CreateRegion(ROW_ID+i, true, 0, Y_BORDER + __cardheight + Y_ROWSTACK_BORDER, 0, Y_ROWSTACK_CARDOFFSET); pRowStack[i] = SolWnd.CreateRegion(ROW_ID+i, true, 0, Y_BORDER + __cardheight + Y_ROWSTACK_BORDER, 0, yRowStackCardOffset);
pRowStack[i]->SetEmptyImage(CS_EI_SUNK); pRowStack[i]->SetEmptyImage(CS_EI_SUNK);
pRowStack[i]->SetFaceDirection(CS_FACE_DOWNUP, i); pRowStack[i]->SetFaceDirection(CS_FACE_DOWNUP, i);

View file

@ -465,16 +465,16 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
SendMessage(hwndStatus, SB_SETPARTS, 2, (LPARAM)parts); SendMessage(hwndStatus, SB_SETPARTS, 2, (LPARAM)parts);
SendMessage(hwndStatus, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)""); SendMessage(hwndStatus, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)"");
SolWnd.Create(hwnd, WS_EX_CLIENTEDGE, WS_CHILD|WS_VISIBLE, 0, 0, 0, 0);
CreateSol();
// The status bar height is fixed and needed later in WM_SIZE and WM_GETMINMAXINFO // The status bar height is fixed and needed later in WM_SIZE and WM_GETMINMAXINFO
// Force the window to process WM_GETMINMAXINFO again // Force the window to process WM_GETMINMAXINFO again
GetWindowRect(hwndStatus, &rcStatus); GetWindowRect(hwndStatus, &rcStatus);
nStatusHeight = rcStatus.bottom - rcStatus.top; nStatusHeight = rcStatus.bottom - rcStatus.top;
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOZORDER); SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOZORDER);
SolWnd.Create(hwnd, WS_EX_CLIENTEDGE, WS_CHILD|WS_VISIBLE, 0, 0, 0, 0);
CreateSol();
NewGame(); NewGame();
dwAppStartTime = GetTickCount(); dwAppStartTime = GetTickCount();
@ -514,7 +514,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
Y_BORDER + Y_BORDER +
__cardheight + __cardheight +
Y_ROWSTACK_BORDER + Y_ROWSTACK_BORDER +
6 * Y_ROWSTACK_CARDOFFSET + 6 * yRowStackCardOffset +
__cardheight + __cardheight +
Y_BORDER + Y_BORDER +
(dwOptions & OPTION_SHOW_STATUS ? nStatusHeight : 0); (dwOptions & OPTION_SHOW_STATUS ? nStatusHeight : 0);

View file

@ -30,7 +30,7 @@ void NewGame(void);
#define X_SUITSTACK_BORDER 10 #define X_SUITSTACK_BORDER 10
#define Y_BORDER 20 #define Y_BORDER 20
#define Y_ROWSTACK_BORDER 32 #define Y_ROWSTACK_BORDER 32
#define Y_ROWSTACK_CARDOFFSET 14 extern int yRowStackCardOffset;
extern CardRegion *pDeck; extern CardRegion *pDeck;
extern CardRegion *pPile; extern CardRegion *pPile;