主要代码如下:
ccV3F_C4B_T2F_Quad quad;
CCSize size = CCDirector::sharedDirector()->getWinSize();
float x = size.width / 2;
float y = size.height / 2;
int imgWidth = atlas->getTexture()->getPixelsWide();
int imgHeight = atlas->getTexture()->getPixelsHigh();
float x1 = (size.width - imgWidth) /2;
float x2 = x1 + imgWidth;
float y1 = (size.height - imgHeight) / 2;
float y2 = y1 + imgHeight;
quad.tl.vertices = vertex3(x1, y2, 0);
quad.tr.vertices = vertex3(x2, y2, 0);
quad.bl.vertices = vertex3(x1, y1, 0);
quad.br.vertices = vertex3(x2, y1, 0);
quad.tl.colors = ccc4(0xff,0xff,0xff,0xff);
quad.tr.colors = ccc4(0xff,0xff,0xff,0xff);
quad.bl.colors = ccc4(0xff,0xff,0xff,0xff);
quad.br.colors = ccc4(0xff,0xff,0xff,0xff);
float left = 0.0f;
float right = 1.0f;
float top = 0.0f;
float bottom = 1.0f;
quad.tl.texCoords = tex2(left, top);
quad.tr.texCoords = tex2(right, top);
quad.bl.texCoords = tex2(left, bottom);
quad.br.texCoords = tex2(right, bottom);
atlas->updateQuad(&quad, 0);
atlas->drawQuads();
CCPoint vertices={
ccp(quad.tl.vertices.x,quad.tl.vertices.y),
ccp(quad.tr.vertices.x,quad.tr.vertices.y),
ccp(quad.br.vertices.x,quad.br.vertices.y),
ccp(quad.bl.vertices.x,quad.bl.vertices.y),
};
ccDrawPoly(vertices, 4, true);
```
显示的结果:
请问如何才能正常显示? 急!
