Ignore:
Timestamp:
Jul 8, 2010, 2:00:13 AM (11 years ago)
Author:
sam
Message:

Rendering starts to work again. There is no Z-sorting yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/layer.cpp

    r75 r79  
    44#include "layer.h"
    55
    6 Layer::Layer(int w, int h, int in_z, uint32_t *in_data)
     6Layer::Layer(int w, int h, int z, uint32_t *in_data)
    77{
    88    width = w;
    99    height = h;
    10     z = in_z;
     10    altitude = z;
    1111    data = in_data;
    1212
     
    2727}
    2828
    29 void Layer::Draw()
     29void Layer::Render(Scene *scene, int x, int y, int z)
    3030{
    31     for (int y = 0; y < 32; y++)
    32         for (int x = 0; x < 32; x++)
    33             ;//tileset->AddTile(GetTile(x, y), x * 32, y * 32, z);
     31    for (int j = 0; j < height; j++)
     32        for (int i = 0; i < width; i++)
     33            if (data[j * width + i])
     34                scene->AddTile(data[j * width + i],
     35                               i * 32 - x, j * 32 - y, altitude + z);
    3436}
    3537
    3638int Layer::GetZ()
    3739{
    38     return z;
     40    return altitude;
    3941}
    4042
    41 unsigned int Layer::GetTile(int x, int y)
    42 {
    43     return data[y * width + x];
    44 }
    45 
Note: See TracChangeset for help on using the changeset viewer.