Skip to content

Commit

Permalink
keybaord
Browse files Browse the repository at this point in the history
  • Loading branch information
hannorein committed Nov 5, 2023
1 parent 5a532d0 commit 78491e7
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,27 +367,28 @@ void* reb_server_start(void* args){
sendBytes(clientS, bufp, sizep);
free(bufp);
}else if (!strncasecmp(uri, "/keyboard/",10)) {
//int key = 0;
//sscanf(uri, "/keyboard/%d", &key);
//switch (key){
// case 'Q':
// data->r->status = REB_STATUS_USER;
int key = 0;
sscanf(uri, "/keyboard/%d", &key);
switch (key){
case 'Q':
data->r->status = REB_STATUS_USER;
// fprintf(stream, "ok.\n");
// break;
// case ' ':
// if (data->r->status == REB_STATUS_PAUSED){
// printf("Resume.\n");
// data->r->status = REB_STATUS_RUNNING;
// }else{
// printf("Pause.\n");
// data->r->status = REB_STATUS_PAUSED;
// }
break;
case ' ':
if (data->r->status == REB_STATUS_PAUSED){
printf("Resume.\n");
data->r->status = REB_STATUS_RUNNING;
}else{
printf("Pause.\n");
data->r->status = REB_STATUS_PAUSED;
}
// fprintf(stream, "ok.\n");
// break;
// default:
// fprintf(stream, "Unknown key received: %d\n",key);
// break;
//}
break;
default:
reb_server_cerror(clientS, "Unknown key received.");
continue;
break;
}
//fflush(stream);
}else if (!strcasecmp(uri, "/") || !strcasecmp(uri, "/index.html") || !strcasecmp(uri, "/rebound.html")) {
FILE *f = fopen("rebound.html", "rb");
Expand Down

0 comments on commit 78491e7

Please sign in to comment.