level 13
savage200
楼主
//Powered by Savage Studio at.17-7-8 EM:log2.0@😎163😎.com
//about:draw circle
//filename:Savage_Circle.h
//基于sdl实现,使用它需要了解sdl基本知识
#ifndef _Savage_Circle
#define _Savage_Circle
#include <SDL2/SDL_render.h>
void Savage_Circle(SDL_Renderer *REN,int R, int x0, int y0, int width, float start_radian, float end_radian) //
{
SDL_Rect rect = { 0, 0,width,width };
for (float i = start_radian; i < end_radian; i += 3.1415926 / 360/5)
{
rect.x = x0 + sin(i) * R -width / 2;
rect.y = y0 + cos(i) * R -width / 2;
SDL_RenderFillRect(REN, &rect);
}
}
void Savage_Circle(SDL_Renderer *REN,int R, int x0, int y0, int width)//
{
return Savage_Circle(REN,R, x0, y0, width, -3.1415926,3.1415926);
}
void Savage_Circle(SDL_Renderer *REN,int R, int x0, int y0)//
{
return Savage_Circle(REN,R, x0, y0, 5, -3.1415926,3.1415926);
}
#endif
2017年07月08日 14点07分
1
//about:draw circle
//filename:Savage_Circle.h
//基于sdl实现,使用它需要了解sdl基本知识
#ifndef _Savage_Circle
#define _Savage_Circle
#include <SDL2/SDL_render.h>
void Savage_Circle(SDL_Renderer *REN,int R, int x0, int y0, int width, float start_radian, float end_radian) //
{
SDL_Rect rect = { 0, 0,width,width };
for (float i = start_radian; i < end_radian; i += 3.1415926 / 360/5)
{
rect.x = x0 + sin(i) * R -width / 2;
rect.y = y0 + cos(i) * R -width / 2;
SDL_RenderFillRect(REN, &rect);
}
}
void Savage_Circle(SDL_Renderer *REN,int R, int x0, int y0, int width)//
{
return Savage_Circle(REN,R, x0, y0, width, -3.1415926,3.1415926);
}
void Savage_Circle(SDL_Renderer *REN,int R, int x0, int y0)//
{
return Savage_Circle(REN,R, x0, y0, 5, -3.1415926,3.1415926);
}
#endif


