Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tetris/src/modules/pong/Pong.h @ 8104

Last change on this file since 8104 was 8104, checked in by dafrick, 13 years ago

Started documenting Pong.

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
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
29/**
30    @file Pong.h
31    @brief Declaration of the Pong class.
32    @ingroup Pong
33*/
34
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
44namespace orxonox
45{
46
47    /**
48    @brief
49        Implements a Pong minigame.
50
51        //TODO: Add details to different classes used and how.
52        PongBall, is the ball, PongBats are the things that can be moved by the players (ControllableEntities), PongCenterpoint is the playing field. (x-z area)
53
54    @author
55        Fabian 'x3n' Landau
56
57    @ingroup Pong
58    */
59    class _PongExport Pong : public Deathmatch
60    {
61        public:
62            Pong(BaseObject* creator); //!< Constructor. Registers and initializes the object.
63            virtual ~Pong(); //!< Destructor. Cleans up, if initialized.
64
65            virtual void start(); //!< Starts the Pong minigame.
66            virtual void end(); ///!< Ends the Pong minigame.
67
68            virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
69
70            virtual void playerScored(PlayerInfo* player); //!< Is called when the player scored.
71
72            /**
73            @brief Set the PongCenterpoint (the playing field).
74            @param center A pointer to the PongCenterpoint to be set.
75            */
76            void setCenterpoint(PongCenterpoint* center)
77                { this->center_ = center; }
78
79            PlayerInfo* getLeftPlayer() const; //!< Get the left player.
80            PlayerInfo* getRightPlayer() const; //!< Get the right player.
81
82        protected:
83            virtual void spawnPlayersIfRequested(); //!< Spawns players, and fills the rest up with bots.
84
85            void startBall(); //!< Starts the ball with some default speed.
86            void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats.
87
88            WeakPtr<PongCenterpoint> center_; //!< The playing field.
89            WeakPtr<PongBall> ball_; //!< The Pong ball.
90            WeakPtr<PongBat> bat_[2]; //!< The two bats.
91            Timer starttimer_; //!< A timer to delay the start of the game.
92    };
93}
94
95#endif /* _Pong_H__ */
Note: See TracBrowser for help on using the repository browser.