Home | History | Annotate | Download | only in examples
      1 #include <rfb/rfb.h>
      2 
      3 
      4 int main(int argc,char** argv)
      5 {
      6   int i;
      7   uint8_t bytes[256*3];
      8 
      9   rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,256,256,8,1,1);
     10   if(!server)
     11     return 0;
     12   server->serverFormat.trueColour=FALSE;
     13   server->colourMap.count=256;
     14   server->colourMap.is16=FALSE;
     15   for(i=0;i<256;i++) {
     16     bytes[i*3+0]=255-i; /* red */
     17     bytes[i*3+1]=0; /* green */
     18     bytes[i*3+2]=i; /* blue */
     19   }
     20   bytes[128*3+0]=0xff;
     21   bytes[128*3+1]=0;
     22   bytes[128*3+2]=0;
     23   server->colourMap.data.bytes=bytes;
     24 
     25   server->frameBuffer=(char*)malloc(256*256);
     26   for(i=0;i<256*256;i++)
     27      server->frameBuffer[i]=(i/256);
     28 
     29   rfbInitServer(server);
     30   rfbRunEventLoop(server,-1,FALSE);
     31 
     32   return(0);
     33 }
     34