diff --git a/src/display.c b/src/display.c index 41a8c3e..a120639 100644 --- a/src/display.c +++ b/src/display.c @@ -43,35 +43,45 @@ static void print_current_image(const struct message* msg, int start, int end) { } +void prntscreen(const struct message *msg, const struct prog_info *pinfo); + void callback(const struct message *msg, const struct prog_info *pinfo) { - printf("in callback, tst=%d\n", msg->timestamp); +// printf("in callback, tst=%d\n", msg->timestamp); // calculate the actual offset to use - int start = msg->timestamp % msg->width + pinfo->client_offset; + //int start = msg->timestamp % msg->width + pinfo->client_offset; - print_current_image(msg, start, start+80); - + //print_current_image(msg, start, start+80); + prntscreen(msg, pinfo); } - +//int init = 0; +//int rows; +//int cols; void prntscreen(const struct message *msg, const struct prog_info *pinfo) { static int init = 0; static int rows; static int cols; if (!init) { +// printf("init start\n"); initscr(); getmaxyx(stdscr, rows, cols); init = 1; +// printf("init end\n"); } - int frame = msg->frame; + int frame = msg->timestamp; int right = pinfo->client_offset; int left = right + cols; - int pos = frame + off; - +// printf("loop\n"); + for (int y=0; y<10; y++) { // yheight; y++) { + for (int x=left-frame; xfps = (int)strtol(argv[++i], NULL, 10); - if (pinfo->fps <= 1 || 50 <= pinfo->fps) { + if (pinfo->fps <= 1 || 100 <= pinfo->fps) { printf("fps invalid!\n"); return -7; }