Exemple :
#include "gpdef.h"
#include "gpstdlib.h"
#include "gpgraphic.h"
#include "gpmain.h"
#include "gpfont.h"
#include "gpmm.h"
GPDRAWSURFACE gpDraw[2];
int nflip = 1;
unsigned char *intro;
unsigned char *get_gpg(char *filename)
{
unsigned char *data;
F_HANDLE hfile;
unsigned long p_read_count;
unsigned long fsize;
hfile = NULL;
if(SM_OK != GpFileOpen(filename, OPEN_R, &hfile))
{
char buffer[200] ;
sprintf(buffer,"get_gpg : error|file not found\n%s",filename) ;
return NULL ;
}
GpFileSeek(hfile, FROM_BEGIN, 8, 0); // skip header
data = gm_zi_malloc(fsize-8); // * sizeof(ushort)
GpFileRead(hfile, data, fsize-8, &p_read_count);
GpFileClose(hfile);
return (data);
}
void GpMain(void *arg)
{
unsigned int i;
for(i = 0 ; i < 2 ; ++i) GpLcdSurfaceGet(&gpDraw[i], i);
GpSurfaceSet(&gpDraw[0]);
GpFatInit();
intro= get_gpg("gp:\gpmm\shoot\gfx\intro\intro.gpg") ;
for( ; ; )
{
GpBitBlt(NULL,&gpDraw[nflip], position a l'ecran en X, position a l'ecran en Y, taille x de l image a afficher, taille y de l image a afficher, intro, 0, 0 , taile x de l image ,taille y de l image) ;
GpSurfaceFlip(&gpDraw[nflip++]);
nflip &= 0x01;
}
}
Cette fonction est assez simple; elle a pour but de charger votre fichier gpg en memoire
