source: trunk/src/layer.cpp @ 70

Last change on this file since 70 was 70, checked in by sam, 11 years ago

Breaking the map/layer code apart. Needs more work.

  • Property svn:keywords set to Id
File size: 577 bytes
Line 
1
2#include "layer.h"
3
4Layer::Layer(int w, int h, int z, char const *base64)
5{
6    width = w;
7    height = h;
8    level = z;
9    data = new unsigned int[w * h];
10
11#if 0
12    fread(data, sizeof(unsigned int), width * height, fp);
13    for (int n = 0; n < width * height; n++)
14    {
15        unsigned int i = data[n];
16        // XXX: endianness swapping might be necessary here
17        data[n] = i ? i - 1 : 0;
18    }
19#endif
20}
21
22Layer::~Layer()
23{
24    delete data;
25}
26
27int Layer::GetZ()
28{
29    return level;
30}
31
32unsigned int Layer::GetTile(int x, int y)
33{
34    return data[y * width + x];
35}
36
Note: See TracBrowser for help on using the repository browser.