You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 line
1.5 KiB

  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. #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. Scene *scene = Scene::GetDefault();
  46. for (int j = 0; j < height; j++)
  47. for (int i = 0; i < width; i++)
  48. if (data[j * width + i])
  49. scene->AddTile(data[j * width + i],
  50. vec3(x + i * 32,
  51. y + j * 32 - altitude,
  52. altitude + z),
  53. orientation);
  54. #endif
  55. }
  56. int Layer::GetZ()
  57. {
  58. return altitude;
  59. }
  60. } /* namespace lol */