//http://www.ferzkopp.net/Software/SDL2_gfx/Docs/html/_s_d_l2__gfx_primitives_8h.html //utilisation de la primitive gfx // ici on ajoute des cercles pein ou vide // on peut aussi ajouter des courbes de bézier, des polygones,des lignes épaisses... void createShapes(){ Sint16 circleR = 100; Sint16 circleX = 300; Sint16 circleY = 300; SDL_Renderer* renderer=SDLS_getRenderer(); filledCircleColor(renderer, circleX, circleY, circleR, 0xFF0000FF); circleRGBA(renderer,200,200,100,0,255,0,255); roundedRectangleRGBA(renderer,10,10,100,100,30,120,120,0,255); thickLineRGBA(renderer,450,150,150,450,50,255,0,255,255); trigonRGBA(renderer,100,100,200,200,100,300,0,255,120,255); Sint16 vx[10]={10,50,150,200, 220,240,410,500,200,250}; Sint16 vy[10]={10,80,10,0,10,30,50,80,30,150}; bezierRGBA(renderer,vx,vy,10,3,50,0,255,255); }
void bezier(void* r_in, int* xs, int* ys, int n, // number of points, >= 3 int s, // steps for the interpolation int r, int g, int b, int a) { SDL_Renderer* renderer = (SDL_Renderer*)r_in; short u[n]; short v[n]; for (int i = 0; i < n ; i++) { u[i] = xs[i]; v[i] = ys[i]; } free(xs); free(ys); bezierRGBA(renderer, u, v, n, s, r, g, b, a); }