diff options
| author | Atsutane <atsutane@freethoughts.de> | 2009-05-07 11:37:09 +0200 |
|---|---|---|
| committer | Atsutane <atsutane@freethoughts.de> | 2009-05-07 11:37:09 +0200 |
| commit | b592632f073e6cabae007a35ee9a86f6bb2d1634 (patch) | |
| tree | f82d63e9d0dff854b0ce7414dc2b821e3a6048bf /src/pong.c | |
| parent | 6f153b1a83b967730b275e90b7eb3509781e92c3 (diff) | |
| download | pong-b592632f073e6cabae007a35ee9a86f6bb2d1634.tar.gz pong-b592632f073e6cabae007a35ee9a86f6bb2d1634.tar.bz2 | |
ball_movement: Added check if the terminal was resized.
Diffstat (limited to 'src/pong.c')
| -rw-r--r-- | src/pong.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -184,6 +184,14 @@ void ball_movement(struct game_data *gd) { /* Clear current position of the ball */ mvaddch(gd->ball->y, gd->ball->x, ' '); + /* If the Terminal was resized, place ball to + * the center of the Terminal. + */ + if (check_field_size(gd) == FALSE) { + gd->ball->y = gd->max_field_y / 2; + gd->ball->x = gd->max_field_x / 2; + } + if (gd->ball->x == 1) { /* Does it hit p1s pad? */ if ((gd->ball->y > gd->p1->y-3) && |
