diff options
author | Nathan Vance <nathav63@gmail.com> | 2015-02-21 18:06:11 -0500 |
---|---|---|
committer | Nathan Vance <nathav63@gmail.com> | 2015-02-21 18:06:11 -0500 |
commit | e723087996663d5a1461297533e57bd2d8174585 (patch) | |
tree | dfd2584267d434c97dd543e8dc0d354a2060f75b /view.c | |
parent | Added view for all wonders (diff) | |
download | 7w-e723087996663d5a1461297533e57bd2d8174585.tar.gz 7w-e723087996663d5a1461297533e57bd2d8174585.tar.bz2 7w-e723087996663d5a1461297533e57bd2d8174585.zip |
Major view improvements
Diffstat (limited to 'view.c')
-rw-r--r-- | view.c | 47 |
1 files changed, 25 insertions, 22 deletions
@@ -1,34 +1,37 @@ #include "7w.h" -void print_wonder(int x, int y, int player, int cursor); -void print_wondersmall(int x, int y, int player); +int print_wonder(int x, int y, int player, int cursor); +int print_wondersmall(int x, int y, int player, int selected, int dir); void io_printcard(int x, int y, int era, int card); void io_printhand(int x, int y, int player, int cursor); void io_clearscreen(); int data_numplayers(); +void io_printhand(int x, int y, int player, int cursor); -void view_refresh(int focus, int cursor, int player) +void view_printwonders(int focus, int cursor, int player) { - io_clearscreen(); - int num = data_numplayers(); - int x, y, i; - int offset = 0; - if(num == 3) x = 0; - if(num == 4 || num == 5) x = 1; - if(num == 6 || num == 7) x = 2, offset = -1; - y = 4; - int change = -1; +int num = data_numplayers(); + int x, y, i, dir; + x = y = 0; for(i = 0; i < num; i++) { - int p = (player+i+offset)%num; - if(p < 0) p += num; + int p = (player+i)%num; + dir = 0; + if(i == 1) dir = 1; + if(i == num-1) dir = 2; if(focus == p) - print_wonder(x*27, y, p, cursor); - else print_wondersmall(x*27, y, p); - if(x == 0) { - if(change == -1) change = 0; - else change = 1; - y = 0; - } - x += change; + print_wonder(34, 0, p, cursor); + y = print_wondersmall(x, y, p, focus == p, dir); + } +} + +void view_refresh(int focus, int cursor, int player) +{ + io_clearscreen(); + if(focus == data_numplayers()) { + view_printwonders(player, -1, player); + io_printhand(61, 0, player, cursor); + } else { + view_printwonders(focus, cursor, player); + io_printhand(61, 0, player, -1); } } |