cxWidgets 1.0
SnakeGame.h
Go to the documentation of this file.
1#ifndef __SNAKEGAME_H__
2#define __SNAKEGAME_H__
3
4#include "../../src/cxWindow.h"
5#include "../../src/cxUtils.h"
6#include "../../src/cxKeyDefines.h"
7#include <deque>
8
9struct Point {
10 int x, y;
11};
12
13class SnakeGame : public cx::cxWindow {
14public:
15 SnakeGame(int pHeight, int pWidth);
16
17 void spawnFood();
18 void draw();
19 void update();
20 void run();
21
22private:
23 enum Direction { UP, DOWN, LEFT, RIGHT };
24 std::deque<Point> mSnake;
25 Point mFood;
26 Direction mDirection;
27 bool mGameOver;
28 int mScore;
29};
30
31#endif
Definition SnakeGame.h:13
void draw()
Fills the member ncurses window structure with the current.
Definition SnakeGame.cpp:33
void run()
Definition SnakeGame.cpp:99
void spawnFood()
Definition SnakeGame.cpp:26
void update()
Definition SnakeGame.cpp:63
Represents a text-based window on the screen. Can contain a title, status, and a message to appear wi...
Definition cxWindow.h:195
Definition CentipedeGame.h:10
int y
Definition CentipedeGame.h:11
int x
Definition CentipedeGame.h:11