thecplusplusguy

Snake game GUI (SDL) - snake.h

Jul 1st, 2011
1,958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cstdlib>
  4. #include <SDL/SDL.h>
  5. #include <SDL/SDL_ttf.h>
  6. #ifndef SNAKE_H
  7. #define SNAKE_H
  8.  
  9. struct snakepart{
  10.     int x,y;
  11.     snakepart(int col,int row);
  12.     snakepart();
  13. };
  14.  
  15. class snakeclass{
  16.     int points,del,width,height;
  17.     char direction;
  18.     bool get;
  19.     snakepart food;
  20.     std::vector<snakepart> snake;
  21.     SDL_Surface* screen;
  22.     TTF_Font* font;
  23.  
  24.     void drawRect(int x,int y,Uint32 color,int w=10,int h=10);
  25.     void putfood();
  26.     bool collision();
  27.     void movesnake();
  28. public:
  29.     snakeclass();
  30.     ~snakeclass();
  31.     void start();
  32. };
  33.  
  34. #endif
Advertisement
Add Comment
Please, Sign In to add comment