find correct positions in pic
This commit is contained in:
parent
584b54b7f8
commit
33781be4d6
|
@ -24,20 +24,19 @@ void cleanup_display() {
|
|||
char *image; // dimension is width x height
|
||||
*/
|
||||
void print_current_image(struct message* msg, int start, int end) {
|
||||
end++; // suppress unused warning :->
|
||||
// end is ignored and 80 is used, should be considered later
|
||||
end = 80; // end is ignored and 80 is used, should be handled properly later
|
||||
|
||||
move(0,0); // start in the upper left corner
|
||||
//move(0,0); // start in the upper left corner
|
||||
char *pic = msg->image; // get a ptr to the actual image
|
||||
|
||||
for (int row=0; row < 25; row++) { // iterate over rows
|
||||
char *original_line;
|
||||
original_line = strtok(pic, "\n");
|
||||
|
||||
char *line = (char*) malloc(81); // allocate a line because we modify it
|
||||
char *original_line = pic + row * msg->width; // pointer to the start of the line to print
|
||||
char *line = (char*) malloc(end+1); // allocate a line because we modify it
|
||||
strcpy(line, original_line + start); // get a line from the right start
|
||||
line[80] = '\0'; // terminate it
|
||||
printw("%s", line); // print it
|
||||
line[end] = '\0'; // terminate it
|
||||
|
||||
mvprintw(row, 0, "%s", line); // print it
|
||||
|
||||
free(line); // free it
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user