source: trunk/src/layer.cpp @ 2183

Last change on this file since 2183 was 2183, checked in by sam, 7 years ago

build: fix the WTFPL site URL in all code comments.

  • Property svn:keywords set to Id
File size: 1.5 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://www.wtfpl.net/ 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    static int error = 1;
51    if (error && !(error = 0))
52        Log::Error("FIXME: Layer::Render no longer works\n");
53#if 0
54    Scene *scene = Scene::GetDefault();
55    for (int j = 0; j < height; j++)
56        for (int i = 0; i < width; i++)
57            if (data[j * width + i])
58                scene->AddTile(data[j * width + i],
59                               vec3(x + i * 32,
60                                     y + j * 32 - altitude,
61                                     altitude + z),
62                               orientation);
63#endif
64}
65
66int Layer::GetZ()
67{
68    return altitude;
69}
70
71} /* namespace lol */
72
Note: See TracBrowser for help on using the repository browser.