No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

layer.cpp 1.5 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include <cstdlib>
  14. #include "core.h"
  15. using namespace std;
  16. namespace lol
  17. {
  18. Layer::Layer(int w, int h, int z, int o, uint32_t *in_data)
  19. {
  20. width = w;
  21. height = h;
  22. altitude = z;
  23. orientation = o;
  24. data = in_data;
  25. #if 0
  26. fread(data, sizeof(unsigned int), width * height, fp);
  27. for (int n = 0; n < width * height; n++)
  28. {
  29. unsigned int i = data[n];
  30. // XXX: endianness swapping might be necessary here
  31. data[n] = i ? i - 1 : 0;
  32. }
  33. #endif
  34. }
  35. Layer::~Layer()
  36. {
  37. free(data);
  38. }
  39. void Layer::Render(int /* x */, int /* y */, int /* z */)
  40. {
  41. static int error = 1;
  42. if (error && !(error = 0))
  43. Log::Error("FIXME: Layer::Render no longer works\n");
  44. #if 0
  45. for (int j = 0; j < height; j++)
  46. for (int i = 0; i < width; i++)
  47. if (data[j * width + i])
  48. g_scene->AddTile(data[j * width + i],
  49. vec3(x + i * 32,
  50. y + j * 32 - altitude,
  51. altitude + z),
  52. orientation);
  53. #endif
  54. }
  55. int Layer::GetZ()
  56. {
  57. return altitude;
  58. }
  59. } /* namespace lol */