Terrain.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # ifndef TERRAIN_HEADER_FILE
  2. # define TERRAIN_HEADER_FILE
  3. // Basiques
  4. # include <iostream>
  5. # include <fstream>
  6. # include <vector>
  7. # include <cmath>
  8. // Random
  9. # include <ctime>
  10. # include <cstdlib>
  11. // SDL
  12. # include <SDL/SDL.h>
  13. # undef main
  14. # include <SDL/SDL_gfxPrimitives.h>
  15. # include <SDL/SDL_image.h>
  16. // bBox2D
  17. # include <box2d/box2d.h>
  18. # define MULTI 100.0f
  19. class Terrain
  20. {
  21. public:
  22. Terrain();
  23. ~Terrain();
  24. void defaultPlot();
  25. void build( b2World &world );
  26. void textureLoad( SDL_Surface* screen );
  27. void accelerateTexture( SDL_Surface* & text );
  28. void draw( SDL_Surface* screen, b2Vec2 origin ); // Pas opti
  29. void drawUni( SDL_Surface* screen, b2Vec2 origin );
  30. void drawWithTexture( SDL_Surface* screen, b2Vec2 origin ); // Lent
  31. void drawArtist( SDL_Surface* screen, b2Vec2 origin ); // Wonderful landscape
  32. void load( std::string chemin );
  33. void setMaxRect();
  34. void setMulti( float newMulti );
  35. protected :
  36. unsigned int m_size ;
  37. float m_multi;
  38. b2Vec2* m_plot; // Static array
  39. b2Body* m_areaBody;
  40. float m_minX;
  41. float m_minY;
  42. float m_maxX;
  43. float m_maxY;
  44. SDL_Surface* m_backTexture;
  45. SDL_Surface* m_groundTexture;
  46. SDL_Surface* m_bricks;
  47. SDL_Surface* m_buff1;
  48. SDL_Surface* m_buff2;
  49. std::vector<Sint16> m_vx;
  50. std::vector<Sint16> m_vy;
  51. };
  52. # endif // TERRAIN_HEADER_FILE