Пример #1
0
// printString()
//
// print string s at x,y using font z
// 
void printString(int x,int y,int z,unsigned char *s)
{
	static int fontLoaded = 0;

	int i,cnum,sx,dx,dy,cy;

	if (fontLoaded == 0) {
		cartCopy(_fontSegmentRomStart, _fontSegmentStart,
			_fontSegmentRomEnd - _fontSegmentRomStart);
		fontLoaded = 1;
	}

	for(i=0;s[i];i++){
		cnum = s[i]-32;
		dx = myFontDx[cnum];
		dy = myFontDy[cnum];
		cy = myFontCy[cnum];

		sx = (dx+1)&254;
		gDPLoadTextureTile_4b(glistp++,
                   myFont[cnum], G_IM_FMT_I, sx, dy, 0, 0,
                   (sx-1)<<G_TEXTURE_IMAGE_FRAC, (dy-1)<<G_TEXTURE_IMAGE_FRAC,
                   0, G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, 
                   G_TX_NOLOD, G_TX_NOLOD);
		gSPTextureRectangle(glistp++,
                   x<<2, (y-cy)<<2, (x+dx)<<2, (y-cy+dy)<<2,
                   0, 0, 0, 0x400, 0x400);
                x += dx+1;
	}
}
Пример #2
0
Файл: gfx.c Проект: glankk/gz
void gfx_disp_rdp_load_tile(Gfx **disp,
                            const struct gfx_texture *texture,
                            int16_t texture_tile)
{
  if (texture->im_siz == G_IM_SIZ_4b) {
    gDPLoadTextureTile_4b((*disp)++,
                          gfx_texture_data(texture, texture_tile),
                          texture->im_fmt,
                          texture->tile_width, texture->tile_height,
                          0, 0,
                          texture->tile_width - 1, texture->tile_height - 1,
                          0,
                          G_TX_NOMIRROR | G_TX_WRAP,
                          G_TX_NOMIRROR | G_TX_WRAP,
                          G_TX_NOMASK, G_TX_NOMASK,
                          G_TX_NOLOD, G_TX_NOLOD);
  }
  else {
    gDPLoadTextureTile((*disp)++,
                       gfx_texture_data(texture, texture_tile),
                       texture->im_fmt, texture->im_siz,
                       texture->tile_width, texture->tile_height,
                       0, 0,
                       texture->tile_width - 1, texture->tile_height - 1,
                       0,
                       G_TX_NOMIRROR | G_TX_WRAP,
                       G_TX_NOMIRROR | G_TX_WRAP,
                       G_TX_NOMASK, G_TX_NOMASK,
                       G_TX_NOLOD, G_TX_NOLOD);
  }
}
Пример #3
0
// printString()
//
// print string s at x,y using font z
// 
void printString(int x,int y,int z,unsigned char *s) {
	OSMesg dummyMessage;
	int ofs,i,sx,dx,dy,cy;

	for(i=0; s[i]; i++){
		ofs=LeoGetAAdr((int)s[i]-32+z*192,&dx,&dy,&cy);

		ddGetFontChar(ofs, currBufferPtr, &dmaMessageQ);

		sx = (dx+1)&254;
		gDPLoadTextureTile_4b(glistp++,
                   currBufferPtr, G_IM_FMT_I, sx, dy, 0, 0,
                   (sx-1)<<G_TEXTURE_IMAGE_FRAC, (dy-1)<<G_TEXTURE_IMAGE_FRAC,
                   0, G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, 
                   G_TX_NOLOD, G_TX_NOLOD);
		gSPTextureRectangle(glistp++,
                   x<<2, (y-cy)<<2, (x+dx)<<2, (y-cy+dy)<<2,
                   0, 0, 0, 0x400, 0x400);
		currBufferPtr+=128;
                x += dx+1;
		osRecvMesg(&dmaMessageQ,&dummyMessage,OS_MESG_BLOCK);
	}
}