my first alphabet train ;)

This commit is contained in:
tkarrass 2013-11-02 21:45:42 +01:00
parent 3da95a5397
commit 2c9b507078
2 changed files with 19 additions and 9 deletions

View File

@ -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;
print_current_image(msg, start, start+80);
//int start = msg->timestamp % msg->width + pinfo->client_offset;
//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++) { // y<msg->height; y++) {
for (int x=left-frame; x<cols; x++) {
mvaddch(y, x, ('0' + x-(left-frame)));
}
}
refresh();
}

View File

@ -67,7 +67,7 @@ int parseArgs(struct prog_info *pinfo, int argc, char **argv) {
return -6;
}
pinfo->fps = (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;
}