summaryrefslogtreecommitdiff
path: root/libphysics/_map.c
blob: 3057bf493ae15d529f04284db647f01731a0baf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <vecmath.h>
#include <physics.h>

#include <stdlib.h>
#include <string.h>

#include "dat.h"

int *phxmapbuffer;
int  phxmapwidth, phxmapheight;

void
phxsetmap(int w, int h, int *tiles)
{
	if(phxmapbuffer)
		free(phxmapbuffer);

	phxmapwidth = w; 
	phxmapheight = h;

	phxmapbuffer = malloc(w * h * sizeof(phxmapbuffer[0]));
	memcpy(phxmapbuffer, tiles, sizeof(phxmapbuffer[0]) * w * h);
}