Merge branch 'master' of ssh://bitsetter.de:8090/netsl
This commit is contained in:
commit
646a1b8806
|
@ -66,6 +66,16 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) {
|
||||||
static char *img = NULL;
|
static char *img = NULL;
|
||||||
static int w;
|
static int w;
|
||||||
static int h;
|
static int h;
|
||||||
|
if (!img && msg->image) {
|
||||||
|
img = msg->image;
|
||||||
|
w = msg->width;
|
||||||
|
h = msg->height;
|
||||||
|
}
|
||||||
|
if (!img) {
|
||||||
|
printf("awaiting state ... %d\r", msg->timestamp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!init) {
|
if (!init) {
|
||||||
// printf("init start\n");
|
// printf("init start\n");
|
||||||
initscr();
|
initscr();
|
||||||
|
@ -74,14 +84,6 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) {
|
||||||
init = 1;
|
init = 1;
|
||||||
// printf("init end\n");
|
// printf("init end\n");
|
||||||
}
|
}
|
||||||
if (!img && msg->image) {
|
|
||||||
img = msg->image;
|
|
||||||
w = msg->width;
|
|
||||||
h = msg->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!img)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int frame = msg->timestamp;
|
int frame = msg->timestamp;
|
||||||
int right = pinfo->client_offset;
|
int right = pinfo->client_offset;
|
||||||
|
@ -93,7 +95,9 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) {
|
||||||
for (int y=0; y<h; y++) { // y<msg->height; y++) {
|
for (int y=0; y<h; y++) { // y<msg->height; y++) {
|
||||||
for (int x=left-frame; x<cols; x++) {
|
for (int x=left-frame; x<cols; x++) {
|
||||||
|
|
||||||
mvaddch(y + rowoffset, x, ('0' + x-(left-frame)+y));
|
//mvaddch(y + rowoffset, x, ('0' + x-(left-frame)+y));
|
||||||
|
int p = x-(left-frame);
|
||||||
|
mvaddch(y + rowoffset, x, p>=w?' ':img[y*w+p]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,6 @@ int run_server(const struct prog_info *pinfo, char *img, int w, int h) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
//printf("sending...\n");
|
//printf("sending...\n");
|
||||||
int numbytes;
|
int numbytes;
|
||||||
// TODO: Hier den Messageblock erstellen und serialisieren.
|
|
||||||
|
|
||||||
t++;
|
t++;
|
||||||
t %= pinfo->width;
|
t %= pinfo->width;
|
||||||
|
@ -102,7 +101,7 @@ int run_server(const struct prog_info *pinfo, char *img, int w, int h) {
|
||||||
|
|
||||||
if ((numbytes = sendto(sockfd, outbuf, buflen, 0, p->ai_addr, p->ai_addrlen)) == -1) {
|
if ((numbytes = sendto(sockfd, outbuf, buflen, 0, p->ai_addr, p->ai_addrlen)) == -1) {
|
||||||
perror("error sending");
|
perror("error sending");
|
||||||
return -44;
|
return -42;
|
||||||
}
|
}
|
||||||
nanosleep(&tim, NULL);
|
nanosleep(&tim, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user