DiPoint.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "DiPoint.h"
  2. #include <SDL2/SDL.h>
  3. #include <SDL2/SDL_image.h>
  4. //Setters
  5. void DiPoint::setFrame(int imageId) {frame = imageId;}
  6. void DiPoint::setLeft(int amount) {location.x = amount;}
  7. void DiPoint::setTop(int amount) {location.y = amount;}
  8. void DiPoint::setRight(int amount) {location.x = amount -image[frame]->w;}
  9. void DiPoint::setBottom(int amount) {location.y = amount -image[frame]->h;}
  10. void DiPoint::setCenterX(int amount) {location.x = amount -(image[frame]->w/2);}
  11. void DiPoint::setCenterY(int amount) {location.y = amount -(image[frame]->h/2);}
  12. void DiPoint::draw(SDL_Surface *screen)
  13. {SDL_BlitSurface(image[frame], NULL, screen, &location);}
  14. SDL_Surface* DiPoint::image[37] =
  15. {
  16. IMG_Load("images/background_bottom_0.png"),
  17. IMG_Load("images/background_bottom_1.png"),
  18. IMG_Load("images/background_top.png"),
  19. IMG_Load("images/cloud_back.png"),
  20. IMG_Load("images/cloud_front.png"),
  21. IMG_Load("images/tree_0.png"),
  22. IMG_Load("images/tree_1.png"),
  23. IMG_Load("images/title.png"),
  24. IMG_Load("images/button.png"),
  25. IMG_Load("images/tutorial.png"),
  26. IMG_Load("images/dark_dimension_logo.png"),
  27. IMG_Load("images/ground_0_0.png"),
  28. IMG_Load("images/ground_1_0.png"),
  29. IMG_Load("images/ground_2_0.png"),
  30. IMG_Load("images/ground_damaged_0.png"),
  31. IMG_Load("images/ground_damaged_1.png"),
  32. IMG_Load("images/ground_damaged_2.png"),
  33. IMG_Load("images/crystal.png"),
  34. IMG_Load("images/magic_mana.png"),
  35. IMG_Load("images/shield.png"),
  36. IMG_Load("images/double_score.png"),
  37. IMG_Load("images/spikes.png"),
  38. IMG_Load("images/sound_yes.png"),
  39. IMG_Load("images/sound_no.png"),
  40. IMG_Load("images/darek_run_0.png"),
  41. IMG_Load("images/darek_run_1.png"),
  42. IMG_Load("images/darek_run_2.png"),
  43. IMG_Load("images/darek_run_3.png"),
  44. IMG_Load("images/darek_run_4.png"),
  45. IMG_Load("images/darek_run_5.png"),
  46. IMG_Load("images/darek_run_6.png"),
  47. IMG_Load("images/darek_run_7.png"),
  48. IMG_Load("images/darek_fall.png"),
  49. IMG_Load("images/darek_jump.png"),
  50. IMG_Load("images/shield_active_0.png"),
  51. IMG_Load("images/shield_active_1.png"),
  52. IMG_Load("images/air_jump_darek.png")
  53. };