TestTextureFormat.h 946 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "test.h"
  3. class TestTextureFormat: public Test
  4. {
  5. public:
  6. bool loaded;
  7. TestTextureFormat()
  8. {
  9. loaded = true;
  10. addButton("", "R8G8B8A8");
  11. addButton("_565", "R5G6B5");
  12. addButton("_4444", "R4G4B4A4");
  13. addButton("_5551", "R5G5B5A1");
  14. updateTest("");
  15. }
  16. void updateTest(string prefix)
  17. {
  18. content->removeChildren();
  19. ResAnim* res = resources.getResAnim("bg" + prefix);
  20. //I unloaded some resources by default to safe some memory
  21. //see res.xml
  22. //line: <set load = "false" /> <!--do not load next atlasses by default-->
  23. Resource* atlas = res->getAtlas();//or use resources.get("your atlas id")
  24. //lets load it now
  25. atlas->load();
  26. spSprite sp = new Sprite;
  27. sp->attachTo(content);
  28. sp->setResAnim(res);
  29. }
  30. void clicked(string id)
  31. {
  32. updateTest(id);
  33. }
  34. };