model for printing
This commit is contained in:
parent
38f2f8d15f
commit
ea62134420
|
@ -1,6 +1,47 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "display.h"
|
||||
|
||||
|
||||
void setup_display() {
|
||||
initscr(); // ncurses initialization
|
||||
curs_set(0); // invisible cursor
|
||||
}
|
||||
|
||||
void cleanup_display() {
|
||||
endwin(); // clean ncurses shutdown
|
||||
}
|
||||
|
||||
/*
|
||||
image[row][col] >>> image[row*width+col];
|
||||
|
||||
uint32_t width; // normally 80
|
||||
uint32_t height; // normally 25, may vary
|
||||
char *image; // dimension is width x height
|
||||
*/
|
||||
void print_current_image(message* msg, int start, int end) {
|
||||
|
||||
move(0,0);
|
||||
char *pic = msg->img;
|
||||
|
||||
for (int row=0; row < 25; row++) {
|
||||
|
||||
char *line = (char*) malloc(81);
|
||||
strcpy(line, strtok(pic, '\n'));
|
||||
line[81] = '\0';
|
||||
printw("%s", line);
|
||||
|
||||
}
|
||||
|
||||
refresh(); // refresh the screen
|
||||
|
||||
}
|
||||
|
||||
|
||||
void callback(long tst) {
|
||||
printf("in callback, tst=%ld\n", tst);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#ifndef __DISPLAY
|
||||
#define __DISPLAY
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void setup_display();
|
||||
void cleanup_display();
|
||||
void callback(long tst);
|
||||
|
||||
void
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user