diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 03:12:30 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 03:12:30 +0100 |
commit | 8dea50c02d5b04221488fb8d4b0719e373e7f9d0 (patch) | |
tree | a6c92a44d2bbc5c2555c11c0f54b3f4a58fc4036 | |
parent | c68227406beb7bc74a4179fb1b1b70bbeb6ad4a2 (diff) |
added the cursor and its position to a character
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r-- | menuchoixpersos.c | 14 | ||||
-rw-r--r-- | players.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/menuchoixpersos.c b/menuchoixpersos.c index d22ce58..3a40875 100644 --- a/menuchoixpersos.c +++ b/menuchoixpersos.c @@ -56,9 +56,19 @@ static void init_team_players(struct team_t *team, bool left, chr->affinities[j] = rand() % AFFINITY_COUNT; } - /* set its position */ - chr->pos.x = (left) ? 20 : XWIN - chr->surf->w - 20; chr->pos.y = (YWIN / ((team->chr_cnt + 1) * 2)) * (2 * (i + 1)) - chr->surf->h / 2; + + if (left) { + chr->curs = surfaces->Pcurseurallies; + chr->pos.x = 20; + chr->pos_curs.x = chr->pos.x + chr->surf->w + 20; + } else { + chr->curs = surfaces->Pcurseurennemis; + chr->pos.x = XWIN - chr->surf->w - 20; + chr->pos_curs.x = chr->pos.x - chr->curs->w - 20; + } + + chr->pos_curs.y = chr->pos.y + chr->surf->h / 2 - chr->curs->h / 2; } } @@ -25,9 +25,12 @@ struct character_t { SDL_Surface *surf; + SDL_Surface *curs; + SDL_Rect pos; SDL_Rect pos_hp; SDL_Rect pos_mp; + SDL_Rect pos_curs; bool alive; |