36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
#ifndef PHP_SDL3_HELPER
|
|
#define PHP_SDL3_HELPER
|
|
|
|
#include <SDL3/SDL.h>
|
|
#include <SDL3_gfx/SDL3_gfxPrimitives.h>
|
|
#include "math.h"
|
|
|
|
// Zeichnet einen gefüllten Viertel-Kreis mit Anti-Aliasing (filled quarter circle).
|
|
// quadrant: 0 = top-left, 1 = top-right, 2 = bottom-right, 3 = bottom-left
|
|
static void filled_quarter_circle(SDL_Renderer *renderer, int cx, int cy, int r, int quadrant) {
|
|
if (r <= 0) return;
|
|
|
|
// Get current draw color
|
|
Uint8 r_col, g_col, b_col, a_col;
|
|
SDL_GetRenderDrawColor(renderer, &r_col, &g_col, &b_col, &a_col);
|
|
|
|
// Use SDL_gfx filledCircle with proper quadrant rendering
|
|
// We'll draw the arc using the primitives library
|
|
switch (quadrant) {
|
|
case 0: // top-left
|
|
filledPieRGBA(renderer, cx, cy, r, 180, 270, r_col, g_col, b_col, a_col);
|
|
break;
|
|
case 1: // top-right
|
|
filledPieRGBA(renderer, cx, cy, r, 270, 360, r_col, g_col, b_col, a_col);
|
|
break;
|
|
case 2: // bottom-right
|
|
filledPieRGBA(renderer, cx, cy, r, 0, 90, r_col, g_col, b_col, a_col);
|
|
break;
|
|
case 3: // bottom-left
|
|
filledPieRGBA(renderer, cx, cy, r, 90, 180, r_col, g_col, b_col, a_col);
|
|
break;
|
|
}
|
|
}
|
|
|
|
#endif
|