aboutsummaryrefslogtreecommitdiff
path: root/solid.c
blob: 40c3656f0be74d22041033e8733baf6da80c5ee0 (plain) (blame)
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
#include "solid.h"

Entity new_solid(World* world, int x, int y, int w, int h) {
	Entity e;
	CCollider* col;
	CPosition* pos;

	e = new_entity(world);
	add_components(
		world,
		e,
		ctype_position |
		ctype_collider |
		ctype_solid
	);
	pos = &world->positions[e];
	col = &world->colliders[e];

	pos->x = x;
	pos->y = y;
	col->x = 0;
	col->y = 0;
	col->w = w;
	col->h = h;

	return e;
}