source: trunk/src/layer.cpp @ 790

Last change on this file since 790 was 790, checked in by sam, 9 years ago

tileset: replace the Tiler ID system with real TileSet objects. The only
thing that is still broken is the Layer <--> Map interface.

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <cstdlib>
16
17#include "core.h"
18
19using namespace std;
20
21namespace lol
22{
23
24Layer::Layer(int w, int h, int z, int o, uint32_t *in_data)
25{
26    width = w;
27    height = h;
28    altitude = z;
29    orientation = o;
30    data = in_data;
31
32#if 0
33    fread(data, sizeof(unsigned int), width * height, fp);
34    for (int n = 0; n < width * height; n++)
35    {
36        unsigned int i = data[n];
37        // XXX: endianness swapping might be necessary here
38        data[n] = i ? i - 1 : 0;
39    }
40#endif
41}
42
43Layer::~Layer()
44{
45    free(data);
46}
47
48void Layer::Render(int x, int y, int z)
49{
50    Log::Error("FIXME: Layer::Render no longer works\n");
51#if 0
52    Scene *scene = Scene::GetDefault();
53    for (int j = 0; j < height; j++)
54        for (int i = 0; i < width; i++)
55            if (data[j * width + i])
56                scene->AddTile(data[j * width + i],
57                               x + i * 32, y + j * 32 - altitude,
58                               altitude + z, orientation);
59#endif
60}
61
62int Layer::GetZ()
63{
64    return altitude;
65}
66
67} /* namespace lol */
68
Note: See TracBrowser for help on using the repository browser.