// This will be two polygons, each being half a gradient bar. Note that // it's ok to mix vertex macro types. void drawbar(float y, float z, float r, float g, float b) { // Top poly (black to white) plx_vert_fnp(PLX_VERT, 0.0f, y, z, 1.0f, r, g, b); plx_vert_inp(PLX_VERT, 0.0f, y - 20.0f, z, 0xff000000); plx_vert_fnp(PLX_VERT, 640.0f, y, z, 1.0f, r, g, b); plx_vert_inp(PLX_VERT_EOS, 640.0f, y - 20, z, 0xff000000); // Bottom poly (white to black) plx_vert_inp(PLX_VERT, 0.0f, y + 20.0f, z, 0xff000000); plx_vert_fnp(PLX_VERT, 0.0f, y, z, 1.0f, r, g, b); plx_vert_inp(PLX_VERT, 640.0f, y + 20.0f, z, 0xff000000); plx_vert_fnp(PLX_VERT_EOS, 640.0f, y, z, 1.0f, r, g, b); }
void pm_drawbar(float pct, float posx, float posy, float posz, uint32 c1, uint32 c2) { const float len = 200.0f; plx_vert_inp(PLX_VERT, posx, posy+6.0f, posz, c1); plx_vert_inp(PLX_VERT, posx, posy, posz, c1); plx_vert_inp(PLX_VERT, posx+len*pct, posy+6.0f, posz, c1); plx_vert_inp(PLX_VERT_EOS, posx+len*pct, posy, posz, c1); plx_vert_inp(PLX_VERT, posx+len*pct, posy+6.0f, posz, c2); plx_vert_inp(PLX_VERT, posx+len*pct, posy, posz, c2); plx_vert_inp(PLX_VERT, posx+len, posy+6.0f, posz, c2); plx_vert_inp(PLX_VERT_EOS, posx+len, posy, posz, c2); }