diff options
-rw-r--r-- | freecell.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/freecell.c b/freecell.c index 2855219..bea3662 100644 --- a/freecell.c +++ b/freecell.c @@ -266,15 +266,24 @@ static bool keyUp(SDL_KeyboardEvent key) { } static bool mouseButtonDown(SDL_MouseButtonEvent button) { + if (button.button != SDL_BUTTON_RIGHT) return false; struct SDL_Point point = { button.x, button.y }; struct Item *item = listFind(&layout.main, &point); + if (!item) return false; + listPush(&reveal, &item->rect, item->card); + return true; +} +static bool mouseButtonUp(SDL_MouseButtonEvent button) { if (button.button == SDL_BUTTON_RIGHT) { - if (!item) return false; - listPush(&reveal, &item->rect, item->card); + if (!reveal.len) return false; + reveal.len = 0; return true; } + struct SDL_Point point = { button.x, button.y }; + struct Item *item = listFind(&layout.main, &point); + if (button.clicks % 2 == 0) { Card card = layout.dragItem.card; if (!card) { @@ -304,15 +313,6 @@ static bool mouseButtonDown(SDL_MouseButtonEvent button) { return true; } -static bool mouseButtonUp(SDL_MouseButtonEvent button) { - if (button.button == SDL_BUTTON_RIGHT) { - if (!reveal.len) return false; - reveal.len = 0; - return true; - } - return false; -} - static SDL_Renderer *render; static void renderOutline(SDL_Rect rect, bool out) { |