void DrawSpritesRot2D(float x, float y, float layer, float dx, float dy, u32 rgba, float angle) { dx /= 2.0f; dy /= 2.0f; MATRIX matrix; // rotate and translate the sprite matrix = MatrixRotationZ(angle); matrix = MatrixMultiply(matrix, MatrixTranslation(x + dx, y + dy, 0.0f)); // fix ModelView Matrix tiny3d_SetMatrixModelView(&matrix); tiny3d_SetPolygon(TINY3D_QUADS); tiny3d_VertexPos(-dx, -dy, layer); tiny3d_VertexColor(rgba); tiny3d_VertexTexture(0.0f , 0.0f); tiny3d_VertexPos(dx , -dy, layer); tiny3d_VertexTexture(0.99f, 0.0f); tiny3d_VertexPos(dx , dy , layer); tiny3d_VertexTexture(0.99f, 0.99f); tiny3d_VertexPos(-dx, dy , layer); tiny3d_VertexTexture(0.0f , 0.99f); tiny3d_End(); tiny3d_SetMatrixModelView(NULL); // set matrix identity }
void DrawSprites2D(float x, float y, float layer, float dx, float dy, u32 rgba) { tiny3d_SetPolygon(TINY3D_QUADS); tiny3d_VertexPos(x , y , layer); tiny3d_VertexColor(rgba); tiny3d_VertexTexture(0.0f, 0.0f); tiny3d_VertexPos(x + dx, y , layer); tiny3d_VertexTexture(0.99f, 0.0f); tiny3d_VertexPos(x + dx, y + dy, layer); tiny3d_VertexTexture(0.99f, 0.99f); tiny3d_VertexPos(x , y + dy, layer); tiny3d_VertexTexture(0.0f, 0.99f); tiny3d_End(); }
void DrawTextBox(float x, float y, float z, float w, float h, u32 rgba) { tiny3d_SetPolygon(TINY3D_QUADS); tiny3d_VertexPos(x , y , z); tiny3d_VertexColor(rgba); tiny3d_VertexTexture(0.0f , 0.0f); tiny3d_VertexPos(x + w, y , z); tiny3d_VertexTexture(0.99f, 0.0f); tiny3d_VertexPos(x + w, y + h, z); tiny3d_VertexTexture(0.99f, 0.99f); tiny3d_VertexPos(x , y + h, z); tiny3d_VertexTexture(0.0f , 0.99f); tiny3d_End(); }
void DrawColorSquare(float x, float y, float z, float dx, float dy, float r, float g, float b, float a) { tiny3d_SetPolygon(TINY3D_QUADS); tiny3d_VertexPos(x , y , z); tiny3d_VertexFcolor(r, g, b, a); tiny3d_VertexTexture(0.0f, 0.0f); tiny3d_VertexPos(x + dx, y , z); tiny3d_VertexTexture(0.99f, 0.0f); tiny3d_VertexPos(x + dx, y + dy, z); tiny3d_VertexTexture(0.99f, 0.99f); tiny3d_VertexPos(x , y + dy, z); tiny3d_VertexTexture(0.0f, 0.99f); tiny3d_End(); }
void DrawSquare(float x, float y, float z, float dx, float dy) { tiny3d_SetPolygon(TINY3D_QUADS); tiny3d_VertexPos(x , y , z); tiny3d_VertexTexture(0.0f, 0.0f); tiny3d_VertexPos(x + dx, y , z); tiny3d_VertexTexture(0.99f, 0.0f); tiny3d_VertexPos(x + dx, y + dy, z); tiny3d_VertexTexture(0.99f, 0.99f); tiny3d_VertexPos(x , y + dy, z); tiny3d_VertexTexture(0.0f, 0.99f); tiny3d_End(); }