Code: Select all
/*This is my vertex structure*/
typedef struct
{
unsigned short u, v;
unsigned int color;
short x, y, z;
unsigned short useless; //for a 16bit struct
} Vertex;
/*In the main loop*/
/*-------------------------------------*/
guStart();
//clean screen
sceGuClearColor(0xff554433);
sceGuClearDepth(0);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
sceKernelDcacheWritebackAll();
sceGuTexImage(0, Alien->textureWidth, Alien->textureHeight, Alien->textureWidth, (void*) Alien->data);
Vertex* vertices = (Vertex*)sceGuGetMemory(mobsterCount *2 * sizeof(Vertex));
/*Filling the vertex buffer*/
int mix=0,miny=0,maxx=60,maxy=60;
for (i=0,h=0;i<mobsterCount;i++,h+=2)
{
vertices[h].u = minx;
vertices[h].v = miny;
vertices[h].color = 0;
vertices[h].x = mobsters[i].x;
vertices[h].y = mobsters[i].y;
vertices[h].z = 0;
vertices[h+1].u = minx+maxx;
vertices[h+1].v = miny+maxy;
vertices[h+1].color = 0;
vertices[h+1].x = mobsters[i].x+maxx;
vertices[h+1].y = mobsters[i].y+maxy;
vertices[h+1].z = 0;
}
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_COLOR_8888|GU_VERTEX_16BIT|GU_TRANSFORM_2D,mobsterCount*2,0,vertices);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuSwapBuffers();