-
-
Save slior/5c1ae2d98e081b88900d66b59a58f759 to your computer and use it in GitHub Desktop.
Mancala (e8a35c608f320f8e18e30ee36cc5dbc43b721d1e) - drawing cell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function drawCell(boardCell,stoneCount) | |
{ | |
var left = 0; | |
var top = 0; | |
switch (true) | |
{ | |
case board.isPlayer1Cell(boardCell) : | |
top = CELL_SIZE /2 - FONT_SIZE/2; | |
left = boardCell * CELL_SIZE + CELL_SIZE/2 - FONT_SIZE/2; | |
break; | |
case board.isPlayer2Cell(boardCell) : | |
top = CELL_SIZE * 2.5 - FONT_SIZE/2; | |
left = (board.totalCellCount() - boardCell) * CELL_SIZE + CELL_SIZE/2 - FONT_SIZE/2; | |
break; | |
default : ERR("Invalid board cell: must be either player 1 or player 2 cell"); | |
} | |
drawText(stoneCount,TOP_LEFT.x + left,TOP_LEFT.y + top); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment