fix bugs and add comments in print_current_image
This commit is contained in:
parent
85783dedea
commit
70da4ca56f
|
@ -24,17 +24,16 @@ void cleanup_display() {
|
||||||
char *image; // dimension is width x height
|
char *image; // dimension is width x height
|
||||||
*/
|
*/
|
||||||
void print_current_image(message* msg, int start, int end) {
|
void print_current_image(message* msg, int start, int end) {
|
||||||
|
// end is ignored and 80 is used, should be considered later
|
||||||
|
|
||||||
move(0,0);
|
move(0,0); // start in the upper left corner
|
||||||
char *pic = msg->img;
|
char *pic = msg->img; // get a ptr to the actual image
|
||||||
|
|
||||||
for (int row=0; row < 25; row++) {
|
for (int row=0; row < 25; row++) { // iterate rows
|
||||||
|
|
||||||
char *line = (char*) malloc(81);
|
char *line = (char*) malloc(81);
|
||||||
strcpy(line, strtok(pic, '\n'));
|
strcpy(line, strtok(pic, '\n')); // get a line
|
||||||
line[81] = '\0';
|
line[80] = '\0'; // terminate
|
||||||
printw("%s", line);
|
printw("%s", line+start);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(); // refresh the screen
|
refresh(); // refresh the screen
|
||||||
|
|
Loading…
Reference in New Issue
Block a user