not really known
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.

71 lines
5.9 KiB

  1. // Class to load all game images in cache
  2. enyo.kind({
  3. name: "ImageCache",
  4. kind: enyo.Control,
  5. events: { onCacheLoaded: "" },
  6. components: [
  7. // Preload images
  8. {kind: "Image", id: "endgame_victory", src:"images/endgame_victory.png", classes: "image-preload", onload: "imageLoaded" },
  9. {kind: "Image", id: "endgame_defeat", src:"images/endgame_defeat.png", classes: "image-preload", onload: "imageLoaded" },
  10. {kind: "Image", id: "target", src:"images/target.png", classes: "image-preload", onload: "imageLoaded" },
  11. {kind: "Image", id: "move", src:"images/move.png", classes: "image-preload", onload: "imageLoaded" },
  12. {kind: "Image", id: "grass", src:"images/grass.png", classes: "image-preload", onload: "imageLoaded" },
  13. {kind: "Image", id: "trees", src:"images/trees.png", classes: "image-preload", onload: "imageLoaded" },
  14. {kind: "Image", id: "mountain", src:"images/mountain.png", classes: "image-preload", onload: "imageLoaded" },
  15. {kind: "Image", id: "water", src:"images/water.png", classes: "image-preload", onload: "imageLoaded" },
  16. {kind: "Image", id: "explosion_1", src:"images/explosion_1.png", classes: "image-preload", onload: "imageLoaded" },
  17. {kind: "Image", id: "explosion_2", src:"images/explosion_2.png", classes: "image-preload", onload: "imageLoaded" },
  18. {kind: "Image", id: "explosion_3", src:"images/explosion_3.png", classes: "image-preload", onload: "imageLoaded" },
  19. {kind: "Image", id: "explosion_4", src:"images/explosion_4.png", classes: "image-preload", onload: "imageLoaded" },
  20. {kind: "Image", id: "explosion_5", src:"images/explosion_5.png", classes: "image-preload", onload: "imageLoaded" },
  21. {kind: "Image", id: "explosion_6", src:"images/explosion_6.png", classes: "image-preload", onload: "imageLoaded" },
  22. {kind: "Image", id: "explosion_7", src:"images/explosion_7.png", classes: "image-preload", onload: "imageLoaded" },
  23. {kind: "Image", id:"helo_blue_0", src:"images/helo_blue_0.png", classes: "image-preload", onload: "imageLoaded" },
  24. {kind: "Image", id:"helo_blue_1", src:"images/helo_blue_1.png", classes: "image-preload", onload: "imageLoaded" },
  25. {kind: "Image", id:"helo_blue_2", src:"images/helo_blue_2.png", classes: "image-preload", onload: "imageLoaded" },
  26. {kind: "Image", id:"helo_blue_3", src:"images/helo_blue_3.png", classes: "image-preload", onload: "imageLoaded" },
  27. {kind: "Image", id:"helo_red_0", src:"images/helo_red_0.png", classes: "image-preload", onload: "imageLoaded" },
  28. {kind: "Image", id:"helo_red_1", src:"images/helo_red_1.png", classes: "image-preload", onload: "imageLoaded" },
  29. {kind: "Image", id:"helo_red_2", src:"images/helo_red_2.png", classes: "image-preload", onload: "imageLoaded" },
  30. {kind: "Image", id:"helo_red_3", src:"images/helo_red_3.png", classes: "image-preload", onload: "imageLoaded" },
  31. {kind: "Image", id:"hq_blue", src:"images/hq_blue.png", classes: "image-preload", onload: "imageLoaded" },
  32. {kind: "Image", id:"hq_red", src:"images/hq_red.png", classes: "image-preload", onload: "imageLoaded" },
  33. {kind: "Image", id:"soldier_blue_0", src:"images/soldier_blue_0.png", classes: "image-preload", onload: "imageLoaded" },
  34. {kind: "Image", id:"soldier_blue_1", src:"images/soldier_blue_1.png", classes: "image-preload", onload: "imageLoaded" },
  35. {kind: "Image", id:"soldier_blue_2", src:"images/soldier_blue_2.png", classes: "image-preload", onload: "imageLoaded" },
  36. {kind: "Image", id:"soldier_blue_3", src:"images/soldier_blue_3.png", classes: "image-preload", onload: "imageLoaded" },
  37. {kind: "Image", id:"soldier_red_0", src:"images/soldier_red_0.png", classes: "image-preload", onload: "imageLoaded" },
  38. {kind: "Image", id:"soldier_red_1", src:"images/soldier_red_1.png", classes: "image-preload", onload: "imageLoaded" },
  39. {kind: "Image", id:"soldier_red_2", src:"images/soldier_red_2.png", classes: "image-preload", onload: "imageLoaded" },
  40. {kind: "Image", id:"soldier_red_3", src:"images/soldier_red_3.png", classes: "image-preload", onload: "imageLoaded" },
  41. {kind: "Image", id:"canon_blue_0", src:"images/canon_blue_0.png", classes: "image-preload", onload: "imageLoaded" },
  42. {kind: "Image", id:"canon_blue_1", src:"images/canon_blue_1.png", classes: "image-preload", onload: "imageLoaded" },
  43. {kind: "Image", id:"canon_blue_2", src:"images/canon_blue_2.png", classes: "image-preload", onload: "imageLoaded" },
  44. {kind: "Image", id:"canon_blue_3", src:"images/canon_blue_3.png", classes: "image-preload", onload: "imageLoaded" },
  45. {kind: "Image", id:"canon_red_0", src:"images/canon_red_0.png", classes: "image-preload", onload: "imageLoaded" },
  46. {kind: "Image", id:"canon_red_1", src:"images/canon_red_1.png", classes: "image-preload", onload: "imageLoaded" },
  47. {kind: "Image", id:"canon_red_2", src:"images/canon_red_2.png", classes: "image-preload", onload: "imageLoaded" },
  48. {kind: "Image", id:"canon_red_3", src:"images/canon_red_3.png", classes: "image-preload", onload: "imageLoaded" },
  49. {kind: "Image", id:"tank_blue_0", src:"images/tank_blue_0.png", classes: "image-preload", onload: "imageLoaded" },
  50. {kind: "Image", id:"tank_blue_1", src:"images/tank_blue_1.png", classes: "image-preload", onload: "imageLoaded" },
  51. {kind: "Image", id:"tank_blue_2", src:"images/tank_blue_2.png", classes: "image-preload", onload: "imageLoaded" },
  52. {kind: "Image", id:"tank_blue_3", src:"images/tank_blue_3.png", classes: "image-preload", onload: "imageLoaded" },
  53. {kind: "Image", id:"tank_red_0", src:"images/tank_red_0.png", classes: "image-preload", onload: "imageLoaded" },
  54. {kind: "Image", id:"tank_red_1", src:"images/tank_red_1.png", classes: "image-preload", onload: "imageLoaded" },
  55. {kind: "Image", id:"tank_red_2", src:"images/tank_red_2.png", classes: "image-preload", onload: "imageLoaded" },
  56. {kind: "Image", id:"tank_red_3", src:"images/tank_red_3.png", classes: "image-preload", onload: "imageLoaded" }
  57. ],
  58. // Constructor
  59. create: function() {
  60. this.imagesToLoad = 49;
  61. this.inherited(arguments);
  62. },
  63. // One image load
  64. imageLoaded: function() {
  65. if (--this.imagesToLoad == 0)
  66. this.doCacheLoaded();
  67. }
  68. });