diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index f415ebba0..35a6ec7e9 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -166,6 +166,7 @@ static const SetInfo bd_ints[] = { ,ARR_MEMBER( BoardDims, height ) ,ARR_MEMBER( BoardDims, scoreHt ) ,ARR_MEMBER( BoardDims, scoreWidth ) + ,ARR_MEMBER( BoardDims, boardWidth ) ,ARR_MEMBER( BoardDims, boardHt ) ,ARR_MEMBER( BoardDims, trayTop ) ,ARR_MEMBER( BoardDims, trayHt ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java index 6fcdc3f2c..be320f098 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDims.java @@ -26,7 +26,7 @@ public class BoardDims { public int left, top; public int width, height; // of the bitmap public int scoreWidth, scoreHt; - public int boardHt; + public int boardWidth, boardHt; public int trayTop, trayHt; public int cellSize, maxCellSize; public int timerWidth; diff --git a/xwords4/common/board.c b/xwords4/common/board.c index 87efba701..15c716608 100644 --- a/xwords4/common/board.c +++ b/xwords4/common/board.c @@ -410,14 +410,14 @@ board_figureLayout( BoardCtxt* board, const CurGameInfo* gi, ldims.left = bLeft; ldims.top = bTop; + ldims.width = bWidth; + ldims.boardWidth = bWidth; for ( firstPass = XP_TRUE; ; ) { - ldims.width = bWidth; - - XP_U16 cellSize = bWidth / nCells; + XP_U16 cellSize = ldims.boardWidth / nCells; if ( cellSize > maxCellSize ) { cellSize = maxCellSize; - ldims.width = nCells * cellSize; + ldims.boardWidth = nCells * cellSize; } ldims.maxCellSize = maxCellSize; @@ -437,7 +437,7 @@ board_figureLayout( BoardCtxt* board, const CurGameInfo* gi, int cellWidth = 2 * (bHeight / ( 4 + 3 + (2*nCells))); if ( firstPass && cellWidth >= fontHt ) { firstPass = XP_FALSE; - bWidth = nCells * cellWidth; + ldims.boardWidth = nCells * cellWidth; continue; } else { nToScroll = nCells - @@ -491,8 +491,9 @@ board_figureLayout( BoardCtxt* board, const CurGameInfo* gi, void board_applyLayout( BoardCtxt* board, const BoardDims* dims ) { - board_setPos( board, dims->left, dims->top + dims->scoreHt, - dims->width, dims->top + dims->scoreHt + dims->boardHt, + XP_U16 margin = (dims->width - dims->boardWidth) / 2; + board_setPos( board, dims->left + margin, dims->top + dims->scoreHt, + dims->boardWidth, dims->top + dims->scoreHt + dims->boardHt, dims->maxCellSize, XP_FALSE ); board_setScoreboardLoc( board, dims->left, dims->top, diff --git a/xwords4/common/board.h b/xwords4/common/board.h index d0e84c8de..e278b6d54 100644 --- a/xwords4/common/board.h +++ b/xwords4/common/board.h @@ -76,11 +76,16 @@ void board_reset( BoardCtxt* board ); #ifdef COMMON_LAYOUT typedef struct _BoardDims { + /* The whole board */ XP_U16 left, top; XP_U16 width, height; + /* scoreboard (full width) */ XP_U16 scoreWidth, scoreHt; - XP_U16 boardHt; + /* board */ + XP_U16 boardWidth, boardHt; + /* tray (full width) */ XP_U16 trayTop, trayHt; + /* other */ XP_U16 cellSize, maxCellSize; XP_U16 timerWidth; } BoardDims;