Orxonox  0.0.5 Codename: Arcturus
Pong.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Fabian 'x3n' Landau
24  * Co-authors:
25  * ...
26  *
27  */
28 
35 #ifndef _Pong_H__
36 #define _Pong_H__
37 
38 #include "pong/PongPrereqs.h"
39 
40 #include "tools/Timer.h"
41 
42 #include "gametypes/Deathmatch.h"
43 #include "PongCenterpoint.h"
44 
45 namespace orxonox
46 {
47 
64  class _PongExport Pong : public Deathmatch
65  {
66  public:
67  Pong(Context* context);
68  virtual ~Pong();
69 
70  virtual void start() override;
71  virtual void end() override;
72 
73  virtual void spawnPlayer(PlayerInfo* player) override;
74 
75  virtual void playerScored(PlayerInfo* player, int score = 1) override;
76 
82  { this->center_ = center; }
83  void setConfigValues();
84 
85  PlayerInfo* getLeftPlayer() const;
86  PlayerInfo* getRightPlayer() const;
87 
88  protected:
89  virtual void spawnPlayersIfRequested() override;
90 
91  void startBall();
92  void cleanup();
93 
96  WeakPtr<PongBat> bat_[2];
99  };
100 }
101 
102 #endif /* _Pong_H__ */
int scoreLimit_
If a player scored that much points, the game is ended.
Definition: Pong.h:98
Declaration of the PongCenterpoint class.
void setCenterpoint(PongCenterpoint *center)
Set the PongCenterpoint (the playing field).
Definition: Pong.h:81
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
Timer starttimer_
A timer to delay the start of the game.
Definition: Pong.h:97
WeakPtr< PongBall > ball_
The Pong ball.
Definition: Pong.h:95
The PongCenterpoint implements the playing field Pong takes place in and allows for many parameters o...
Definition: PongCenterpoint.h:120
Declaration of the Timer class, used to call functions after a given time-interval.
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Implements a Pong minigame (Wikipedia::Pong).
Definition: Pong.h:64
Definition: Context.h:45
Definition: Deathmatch.h:37
WeakPtr< PongCenterpoint > center_
The playing field.
Definition: Pong.h:94
Definition: PlayerInfo.h:39
#define _PongExport
Definition: PongPrereqs.h:60
Shared library macros, enums, constants and forward declarations for the pong module ...
Timer is a helper class that executes a function after a given amount of seconds in game-time...
Definition: Timer.h:105