diff options
author | June McEnroe <june@causal.agency> | 2019-03-29 17:19:32 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-03-29 17:19:32 -0400 |
commit | 8eab8c604d6c8800c9b13eea5e1724183197438b (patch) | |
tree | 5cd774545d2ca109667d072bf07518734a4fd764 | |
parent | Load king bitmaps in freecell (diff) | |
download | cards-8eab8c604d6c8800c9b13eea5e1724183197438b.tar.gz cards-8eab8c604d6c8800c9b13eea5e1724183197438b.zip |
Change king face direction
Diffstat (limited to '')
-rw-r--r-- | freecell.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/freecell.c b/freecell.c index 178da57..ea7b8b6 100644 --- a/freecell.c +++ b/freecell.c @@ -49,6 +49,8 @@ enum { static struct Stack stacks[StacksLen]; +static uint kingFace = Cards_KingRight; + static void gameDeal(void) { for (uint i = 0; i < StacksLen; ++i) { stackClear(&stacks[i]); @@ -64,6 +66,7 @@ static void gameDeal(void) { for (uint i = Tableau5; i <= Tableau8; ++i) { stackMoveTo(&stacks[i], &deck, 6); } + kingFace = Cards_KingRight; } static bool gameFind(uint *stack, uint *index, Card card) { @@ -90,11 +93,13 @@ static bool gameMove(uint dest, Card card) { if (source == dest) return false; if (dest >= Cell1 && dest <= Cell4) { if (stacks[dest].len) return false; + kingFace = Cards_KingLeft; } if (dest >= Foundation1 && dest <= Foundation4) { if (!destTop && cardRank(card) != Cards_A) return false; if (destTop && cardSuit(card) != cardSuit(destTop)) return false; if (destTop && cardRank(card) != cardRank(destTop) + 1) return false; + kingFace = Cards_KingRight; } if (dest >= Tableau1 && dest <= Tableau8) { if (destTop && cardColor(card) == cardColor(destTop)) return false; @@ -315,8 +320,7 @@ static void renderKing(SDL_Texture *textures[]) { KingX + KingPadX, KingY + KingPadY, Cards_KingWidth, Cards_KingHeight, }; - // TODO: Determine king direction. - SDL_RenderCopy(render, textures[Cards_KingRight], NULL, &king); + SDL_RenderCopy(render, textures[kingFace], NULL, &king); } static void renderList(SDL_Texture *textures[], const struct List *list) { |