闲得无聊,写个绘圆圈函数送给小白!🎓😎😎😎
c4droid吧
全部回复
仅看楼主
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
level 13
savage200 楼主
2017年07月08日 15点07分 2
level 13
savage200 楼主
2017年07月08日 15点07分 3
level 5
这😊😊😊😊😊个球画得好扁😁😁😁😁😁!
2017年07月08日 17点07分 4
level 7
效率怎么样?fps多少?
2017年07月09日 00点07分 6
level 7
2017年07月09日 00点07分 7
agg?
2017年07月09日 15点07分
@savage200 不是,sdl绘图
2017年07月09日 16点07分
回复 sdlcja agg也是sdl
2017年07月11日 03点07分
@savage200 这个我自己写的
2017年07月11日 16点07分
level 11
用八分法和breshman画圆法效率高
2017年07月09日 00点07分 8
[真棒]
2017年07月09日 14点07分
level 9
sdl你好
2017年07月25日 02点07分 9
1