Skip to content

Commit

Permalink
Fix missing redraw of remaining pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverHaag committed Aug 11, 2019
1 parent 962bc8e commit 507c222
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pb-mahjong
Mahjong puzzle for PocketBook eReaders
Mahjong Solitaire for PocketBook eReaders
## Building
1. Clone <https://github.com/pocketbook/SDK_6.3.0/tree/5.19> and set it up as described
2. Configure with `cmake -DCMAKE_TOOLCHAIN_FILE=$SDK_DIR/SDK-$ARCHITECTURE/share/cmake/arm_conf.cmake -DCMAKE_BUILD_TYPE=Release`, replacing `$SDK_DIR` and `$ARCHITECTURE` accordingly
Expand All @@ -9,5 +9,5 @@ Mahjong puzzle for PocketBook eReaders
6. Extend your language file (e. g. system/language/en.txt) for a nicer menu entry:
```
English
@Pb-mahjong=Mahjong
@Pb-mahjong=Mahjong Solitaire
```
8 changes: 0 additions & 8 deletions src/geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

#include "geometry.h"

void union_rect(const struct rect* r1, const struct rect* r2, struct rect* r)
{
r->x = min_int(r1->x, r2->x);
r->y = min_int(r1->y, r2->y);
r->w = max_int(r1->x + r1->w, r2->x + r2->w) - r->x;
r->h = max_int(r1->y + r1->h, r2->y + r2->h) - r->y;
}

void point_change_orientation(int x, int y, int orientation, int *rx, int *ry)
{
#ifdef __EMU__ // bug in emulator
Expand Down
2 changes: 0 additions & 2 deletions src/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ struct rect {
int x, y, w, h;
};

void union_rect(const struct rect* r1, const struct rect* r2, struct rect* r);

void point_change_orientation(int x, int y, int orientation, int *rx, int *ry);

int point_in_rect(int x, int y, const struct rect* r);
Expand Down
23 changes: 10 additions & 13 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,15 @@ static void select_cell(void)
{
main_repaint();

struct rect r;
union_rect(&r1, &r2, &r);
const int bw = r1.w / 8;
PartialUpdate(r.x - bw, r.y - bw, r.w + bw, r.h + bw);
PartialUpdate(r1.x - bw, r1.y - bw, r1.w + bw, r1.h + bw);
PartialUpdate(r2.x - bw, r2.y - bw, r2.w + bw, r2.h + bw);
struct rect r;
r.x = 0;
r.y = ScreenHeight() - HELP_HEIGHT;
r.w = ScreenWidth();
r.h = HELP_HEIGHT;
PartialUpdate(r.x, r.y, r.w, r.h);
}
}
else
Expand All @@ -433,16 +438,8 @@ static void select_cell(void)
main_repaint();

if (prev_selection_pos != -1)
{
struct rect r;

union_rect(&r1, &r2, &r);
PartialUpdate(r.x, r.y, r.w, r.h);
}
else
{
PartialUpdate(r2.x, r2.y, r2.w, r2.h);
}
PartialUpdate(r1.x, r1.y, r1.w, r1.h);
PartialUpdate(r2.x, r2.y, r2.w, r2.h);
}
}

Expand Down

0 comments on commit 507c222

Please sign in to comment.