From 44dd6ad61dfed5d89f8abf7e8f41797501f071cc Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 25 Sep 2024 17:16:54 -0400 Subject: refactor graphics functions --- balls.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'balls.c') diff --git a/balls.c b/balls.c index d742d67..1a10e42 100644 --- a/balls.c +++ b/balls.c @@ -48,7 +48,6 @@ static Rectangle bounds = {{PAD, PAD}, {PAD+WIDTH, PAD+HEIGHT}}; int init(char *label, Mousectl **mctl, Keyboardctl **kctl); void spawnball(void); -void drawbg(Image *walls, Image *bg); void spawnballs(int n); Channel **allocchans(int nchans, int elsize, int nel); void mcopycolskip(Channel *vec[], Channel **matrix[], int n, int col, int skip); @@ -57,8 +56,6 @@ void nooverlapcircles(Point centers[], int n); Point randptinrect(Rectangle r); int randint(int lo, int hi); void ball(void *arg); -Image *alloccircle(int fg, int bg); -void drawcircle(Image *m, Point pos); void broadcast(Point p, Channel *cs[], int n); void frametick(void *arg); @@ -131,13 +128,6 @@ init(char *label, Mousectl **mctl, Keyboardctl **kctl) { return 0; } -void -drawbg(Image *walls, Image *bg) { - draw(screen, screen->r, walls, nil, ZP); - draw(screen, screen->r, bg, nil, ZP); - flushimage(display, Refnone); -} - void spawnballs(int n) { Channel **ticks; @@ -314,30 +304,6 @@ ball(void *arg) { } } -Image * -alloccircle(int fg, int bg) { - Image *m, *fill -; - m = allocimage(display, Rect(0, 0, 2*RADIUS, 2*RADIUS), RGBA32, 0, bg); - if (m == nil) - return nil; - - fill = allocimage(display, Rect(0, 0, 1, 1), RGBA32, 1, fg); - if (fill == nil) { - free(m); - return nil; - } - - fillellipse(m, Pt(RADIUS, RADIUS), RADIUS, RADIUS, fill, ZP); - freeimage(fill); - return m; -} - -void -drawcircle(Image *m, Point pos) { - draw(screen, rectaddpt(bounds, subpt(pos, Pt(RADIUS, RADIUS))), m, nil, ZP); -} - void broadcast(Point p, Channel *cs[], int n) { while (n-- > 0) -- cgit v1.2.3