You are not logged in.

#1 2009-06-29 06:55:44

eckyecky
Member

GRRLIB_DrawCircle

The current svn version doesn't draw a full circle there is a small section missing on a non filled circle
the following code draw a full circle.

Code:

inline void GRRLIB_Circle(f32 x, f32 y, f32 radius, u32 color, u8 filled) {
    Vector v[37];
    u32 ncolor[37];
    u32 a;
    f32 ra;
    f32 G_DTOR = M_DTOR * 10;

    for (a = 0; a < 37; a++) {
        ra = a * G_DTOR;

        v[a].x = cos(ra) * radius + x;
        v[a].y = sin(ra) * radius + y;
        v[a].z = 0.0f;
        ncolor[a]  = color;
    }

    if (!filled) {
        GRRLIB_GXEngine(v, ncolor, 37, GX_LINESTRIP);
    }
    else {
        GRRLIB_GXEngine(v, ncolor, 37, GX_TRIANGLEFAN);
    }
}

Last edited by eckyecky (2009-06-29 06:57:37)

Offline

 

#2 2009-06-29 20:21:08

suloku
Member

Re: GRRLIB_DrawCircle

I'd like to say that this function should be by default a elpise drawing one (have diferent vars for X and Y radius). To draw a circle just use the same radius.

Offline

 

#3 2009-07-20 16:08:21

BlueChip
Moderator

Re: GRRLIB_DrawCircle

I agree with suloku
Call the function GRRLIB_Elipse() and add the extra pram
If you wish, you can then add a GRRLIB_Circle which calls Elipse with a duplicated parameter (for friendly programmer interface)


I can be found on efnet, freenode, msn, gtalk, aim, ychat & icq ...PM me for details

Offline

 

Board footer

Powered by FluxBB