Skocz do zawartości

Round Rect


baca

Rekomendowane odpowiedzi

Czy ktoś by mi mógł przerobić ten kod żeby round rect obsłógiwał cztery kolory, każdy kolor z jednego rogu.

 

</P><P>void Renderer::DrawRoundRect(float x1, float y1, float x2, float y2, float radius, DWORD color)</P><P>{</P><P>    VewrtexBegin(PR_TRIANGLE_FAN);
            DrawVertex(x1+radius, y1, color);
          DrawVertex(x2-radius, y1, color);
           for(float t =M_PI* 1.5f; t < M_PI * 2; t+=0.1f){
                 float sx = x2 - radius + (float)cos(t) * radius;
                 float sy = y1 + radius + (float)sin(t) * radius;
                    DrawVertex(sx, sy);
          }
             DrawVertex(x2, y1+radius);
          DrawVertex(x2, y2-radius);
          for(float t =0; t < M_PI*0.5f; t+=0.1f){
                float sx = x2 - radius + cos(t)*radius;
                float sy = y2 -radius + sin(t) * radius;
                DrawVertex (sx, sy);
        }
        
        DrawVertex(x2 -radius, y2);
        GL11.glVertex2f (x1 +radius, y2);
        for(float t =3.1415f * 0.5f; t < M_PI; t+=0.1f){
            float sx = x1  + radius + cos(t) * radius;
            float sy = y2 - radius + sin(t) * radius;
             DrawVertex(sx, sy);
        }
        
        DrawVertex(x1, y2 - radius);
         DrawVertex(x1, y1 +radius);
        for(float t =M_PI; t <M_PI * 1.5f; t+=0.1f){
            float sx = x1 + radius + cos(t) * radius;
            float sy = y1 + radius + sin(t) * radius;
            DrawVertex(sx, sy);
        }
        
        VertexEnd();
}
</P><P>

 

(z pamięci pisałem to mogą być błędy.)

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...