The function draw a circle and a second counting arrow and redraw the circle every second, the parameter time hast to initialized outside the while loop.
void putpixel(SDL_Surface* screen, int x, int y)
{
Uint32 *pixel = (Uint32*)screen->pixels;
Uint32 *p = pixel + y*screen->pitch/4 + x;
*p = SDL_MapRGB(screen->format, 0x00, 0x64,0x00);
}
void DrawCircle(SDL_Surface* screen, float time)
{
for(int i = 0; i<=360; i++)
{
putpixel(screen, (200 + (100*cos(i))), (100 + (100*sin(i))));
}
for(int j = 0; j<=100; j++)
{
putpixel(screen, (200 + (j*cos(time))), (100 + (j*sin(time))));
}
Sleep(1000);
}
Subscribe to:
Post Comments (Atom)
How to create Custom push button in QT5
To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...
-
Drawing a graph on an x, y plane... you can disregard the load image function, remember i am using the sdl_draw.h library, which is freely a...
-
Progress Bar #include "sdl/sdl.h" #include "sdl/sdl_image.h" #include "SDL/SDL_ttf.h" #include "sdl/...
-
To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...
No comments:
Post a Comment