thecplusplusguy

Snake game (ncurses version) - snake.h

Jul 1st, 2011
5,390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <ncurses.h>
  4. #include <cstdlib>
  5. #ifndef SNAKE_H
  6. #define SNAKE_H
  7. struct snakepart{
  8.     int x,y;
  9.     snakepart(int col, int row);
  10.     snakepart();
  11. };
  12.  
  13. class snakeclass{
  14.     int points,del;
  15.     //indicates that the snake get food (it makes the snake longer)
  16.     bool get;
  17.     //indicates the current direction of the snake
  18.     char direction;
  19.  
  20.     int maxwidth;
  21.     int maxheight;
  22.     char partchar;
  23.     char oldalchar;
  24.     char etel;
  25.     snakepart food;
  26.     std::vector<snakepart> snake; //represent the snake
  27.  
  28.     void putfood();
  29.     bool collision();
  30.     void movesnake();
  31.    
  32. public:
  33.     snakeclass();
  34.     ~snakeclass();
  35.     void start();
  36. };
  37.  
  38. #endif
Advertisement
Add Comment
Please, Sign In to add comment