summaryrefslogtreecommitdiffstats
path: root/src/ball.c
blob: 91c299513e731826238f31ec7adabb5cc16ae778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdlib.h>
#include <curses.h>

#include "ball.h"

struct ball *
new_ball(float x, float y)
{
	struct ball *b;

	b = malloc(sizeof(*b));
	if (b == NULL) {
		return NULL;
	}

	b->x = x;
	b->y = y;

	return b;
}

void
free_ball(struct ball *b)
{
	free(b);
}

void
clear_ball(struct ball *b)
{
	mvprintw((int) (b->y + 0.5), (int) (b->x + 0.5), " ");
}

void
update_ball(struct ball *b)
{
	++b;
}

void
draw_ball(struct ball *b)
{
	mvprintw((int) (b->y + 0.5), (int) (b->x + 0.5), "o");
}