void SDL_DrawStripedCircle(SDL_Renderer* renderer, float radius, float centerX, float centerY, float theta) { SDL_DrawCircle(renderer, radius, centerX, centerY); SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderDrawLine(renderer, centerX+radius*cosf(theta), centerY+radius*sinf(theta), centerX-radius*cosf(theta), centerY-radius*sinf(theta)); SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); }
void drawCurve(SDL_Renderer* renderer, trackObj track) { float distBetweenPointsInPixels=DRAW_WIDTH/(track.heightList.size()-1); float drawBorderX=(SCREEN_WIDTH-DRAW_WIDTH)/2; float drawBorderY=(SCREEN_HEIGHT-DRAW_HEIGHT)/2; //Draw Dots for (int i=0; i<track.heightList.size(); i++) { float pixelX=distBetweenPointsInPixels*i+drawBorderX; float pixelY=(1-track.heightList[i])*DRAW_HEIGHT+drawBorderY; SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_DrawCircle(renderer, DOT_WIDTH/2, pixelX, pixelY); } //Draw Lines for (int i=1; i<track.heightList.size(); i++) { float thisPixelX=distBetweenPointsInPixels*i+drawBorderX; float thisPixelY=(1-track.heightList[i])*DRAW_HEIGHT+drawBorderY; float lastPixelX=distBetweenPointsInPixels*(i-1)+drawBorderX; float lastPixelY=(1-track.heightList[i-1])*DRAW_HEIGHT+drawBorderY; SDL_RenderDrawLine(renderer, thisPixelX, thisPixelY, lastPixelX, lastPixelY); } }
void graphics_draw_circle(GContext *ctx, GPoint p, int radius) { LOCK(screen); SDL_DrawCircle(screen, p.x, p.y, radius, r_white); UNLOCK(screen); }