[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GGI Trick



Hi!

Perhaps someone finds this code useful, it helps to display 8 Bit
graphics everywhere (including 16 bit or 24 Bit X-Servers),
automatically with GGI:

Perhaps someone wants to include it into the tutorials.

--------
      GfxScreen=new char[320*300];

      if(vis!=NULL) return 0;
      if(ggiInit()) return 0;
      printf("GGI_DISPLAY=%s\n",getenv("GGI_DISPLAY"));
      if((vis=ggiOpen(NULL))==NULL) return 0;
      printf("GGI-Visual ok.\n");
      if(ggiSetGraphMode(vis,320,200,320,200,GT_8BIT)) 
      {
        printf("8 Bit Mode doesn´t work.\n");
        printf("Closing the visual ...\n");
        if(vis!=NULL) if(ggiClose(vis)) return 0;
        printf("Trying palemu mode ...\n");
        if((vis=ggiOpen("display-palemu",NULL))==NULL) return 0;
        printf("Palemu-Visual ok.\n");
        if(ggiSetGraphMode(vis,320,200,320,200,GT_8BIT)) return 0;
        printf("Palemu works!\n");
      }
      printf("Grafikmode ok.\n");
      if((db=ggiDBGetBuffer(vis,0))==NULL)
      {
        printf("Normalbuffering\n");
//        GfxScreen=new char[320*300];
      }
      else
      {
        printf("DirectBuffering\n");
        //if(db->type!=GGI_DB_SIMPLE_PLB|GGI_DB_NORMAL) return 0;
        printf("Buffer bekommen.\n");
        GfxScreen=(S1*)db->write;
      }
------------

Many greetings,
--
~ Philipp Gühring              p.guehring@poboxes.com
~ http://www.poboxes.com/p.guehring  ICQ UIN: 6588261