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
RevLine 
[38]1
2#include "layer.h"
3
[70]4Layer::Layer(int w, int h, int z, char const *base64)
[38]5{
6    width = w;
7    height = h;
[70]8    level = z;
[38]9    data = new unsigned int[w * h];
10
[70]11#if 0
[38]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    }
[70]19#endif
[38]20}
21
22Layer::~Layer()
23{
24    delete data;
25}
26
[47]27int Layer::GetZ()
28{
[70]29    return level;
[47]30}
31
[38]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.