~ubuntu-branches/ubuntu/feisty/groundhog/feisty

« back to all changes in this revision

Viewing changes to src/ball.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-01-29 19:11:33 UTC
  • Revision ID: james.westby@ubuntu.com-20020129191133-r8u9eu0ggn5xbws4
Tags: upstream-1.3.2
ImportĀ upstreamĀ versionĀ 1.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Groundhog -- a simple logic game
 
2
 * Copyright (C) 1998-2001 Maurits Rijk
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#ifndef _BALL_H_
 
20
#define _BALL_H_
 
21
 
 
22
#include <list>
 
23
 
 
24
class Element;
 
25
 
 
26
class Ball {
 
27
public:
 
28
   typedef enum {Red, Green, Blue, Yellow} Color;
 
29
   typedef enum {NotMoving, MovingLeft, MovingUp, MovingRight, 
 
30
                 MovingDown} Direction;
 
31
private:
 
32
   Element*             _element;
 
33
   Ball::Direction      _direction;
 
34
   Ball::Color          _color;
 
35
public:   
 
36
   Ball(Ball::Color color);
 
37
   void Move();
 
38
   void SetElement(Element* element) {_element = element;}
 
39
   Ball::Color GetColor() {return _color;}
 
40
   Ball::Direction GetDirection() {return _direction;}
 
41
   void SetDirection(Ball::Direction direction) {_direction = direction;}
 
42
};
 
43
 
 
44
class SetOffBalls {
 
45
   std::list<Ball*> _set;
 
46
public:
 
47
   SetOffBalls() {}
 
48
   void Add(Ball* ball) {_set.push_back(ball);}
 
49
   void MakeEmpty() {_set.erase(_set.begin(), _set.end());}
 
50
   bool Move();
 
51
};
 
52
 
 
53
#endif // _BALL_H_
 
54