The thing is that I'm stuck in converting my engine to libgdx. The origin / pivot is where the problem lies.
So, could someone please translate the following GL11 non-es code into a spirtebatch.draw call?
- Code: Select all
GL11.glPushMatrix();
GL11.glColor4f(r, g, b, alpha);
GL11.glTranslatef(x, y, z);
GL11.glRotatef(rotation, 0, 0, 1);
GL11.glScalef(scaleX, scaleY, 1);
GL11.glTranslatef(-pivotX - (width /2) + px, -pivotY - (height /2) + py, 0);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(0, 0);
GL11.glTexCoord2f(1, 0);
GL11.glVertex2f(1, 0);
GL11.glTexCoord2f(1, 1);
GL11.glVertex2f(1, 1);
GL11.glTexCoord2f(0, 1);
GL11.glVertex2f(0, 1);
GL11.glEnd();
GL11.glPopMatrix();
This is as close as I get, but from here on it's just been trial and error for me.
- Code: Select all
spiteBatch.draw(texture, x - (width / 2), y - (height / 2), -pivotX - (width / 2), -pivotY - (height / 2), width, height, scaleX, scaleY, rotation, 0, height, width, -height, mirrorX , mirrorY );
Anyone? Pretty please.
