diff options
author | Franklin Wei <git@fwei.tk> | 2017-01-13 19:11:33 -0500 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-01-13 23:22:51 -0500 |
commit | 8e4429853d1ac024ac2b8069636cc210cf5bab1b (patch) | |
tree | 13528d977018df1d5c2daf819004bd9f49f6f5b8 /apps/plugins/puzzles/untangle.c | |
parent | 79e8cd4cfe852836c46bea5216ab308439688689 (diff) |
puzzles: antialiased line drawing and optional "shortcuts" for undo/redo
- line drawing should eventually be moved to xlcd, but for now it's very nonportable code
- fixes a minor issue with the configuration screens
Change-Id: I897f01b7210cbbec32665c2bc67920c965ea0bec
Diffstat (limited to 'apps/plugins/puzzles/untangle.c')
-rw-r--r-- | apps/plugins/puzzles/untangle.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/plugins/puzzles/untangle.c b/apps/plugins/puzzles/untangle.c index 839013809b..d46afcbe66 100644 --- a/apps/plugins/puzzles/untangle.c +++ b/apps/plugins/puzzles/untangle.c @@ -1162,18 +1162,17 @@ static char *interpret_move(const game_state *state, game_ui *ui, { if(ui->dragpoint < 0) { - if(ui->cursorpoint < 0) - { - ui->cursorpoint = 0; - return ""; - } - /* We're selecting a point here. */ /* Search all the points and find the closest one (2-D) in * the given direction. */ int i, best; long bestd; + if(ui->cursorpoint < 0) + { + ui->cursorpoint = 0; + } + /* * Begin drag. We drag the vertex _nearest_ to the pointer, * just in case one is nearly on top of another and we want @@ -1196,7 +1195,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, /* Figure out if this point falls into a 90 degree * range extending from the current point */ - float angle = atan2(-dy, dx); /* adjust for raster coordinates */ + float angle = atan2(-dy, dx); /* negate y to adjust for raster coordinates */ /* offset to [0..2*PI] */ if(angle < 0) @@ -1494,6 +1493,8 @@ static void game_redraw(drawing *dr, game_drawstate *ds, ds->bg = bg; game_compute_size(&state->params, ds->tilesize, &w, &h); + + clip(dr, 0, 0, w, h); draw_rect(dr, 0, 0, w, h, bg); /* |