Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/minigame4DHS14/src/modules/mini4Dgame/Mini4DgameCenterpoint.h @ 10104

Last change on this file since 10104 was 10101, checked in by richtero, 10 years ago

first working compile

File size: 5.4 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 Mini4DgameCenterpoint.h
31    @brief Declaration of the Mini4DgameCenterpoint class.
32*/
33
34#ifndef _Mini4DgameCenterpoint_H__
35#define _Mini4DgameCenterpoint_H__
36
37#include <string>
38
39#include <util/Math.h>
40
41#include "worldentities/StaticEntity.h"
42#include "mini4Dgame/Mini4DgamePrereqs.h"
43
44namespace orxonox
45{
46   
47    /**
48    @brief
49        The Mini4DgameCenterpoint implements the playing field @ref orxonox::Mini4Dgame "Mini4Dgame" takes place in and allows for many parameters of the minigame to be set.
50       
51        Various parameters can be set:
52        - The <b>dimension</b> is a vector, that defines the width and height of the playing field. The default is <em>(200, 120)</em>.
53        - The <b>balltemplate</b> is a template that is applied to the @ref orxonox::PongBall "PongBall", it can be used to attach different things to it, e.g. its @ref orxonox::Model "Model". See below for a usage example.
54        - The <b>battemplate</b> is a template that is applied to the @ref orxonox::PongBall "PongBat", it can be used to attach different things to it, e.g. its @ref orxonox::Model "Model". See below for a usage example.
55        - The <b>ballspeed</b> is the speed with which the @ref orxonox::PongBall "PongBall" moves. The default is <em>100</em>.
56        - The <b>ballaccfactor</b> is the acceleration factor for the @ref orxonox::PongBall "PongBall". The default is <em>1.0</em>.
57        - The <b>batspeed</b> is the speed with which the @ref orxonox::PongBat "PongBats" move. The default is <em>60</em>.
58        - The <b>batlength</b> is the length of the @ref orxonox::PongBat "PongBats" as the percentage of the height of the playing field. The default is <em>0.25</em>.
59    */
60    class _Mini4DgameExport Mini4DgameCenterpoint : public StaticEntity
61    {
62        public:
63            Mini4DgameCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Mini4Dgame.
64            virtual ~Mini4DgameCenterpoint() {}
65
66            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a Mini4DgameCenterpoint through XML.
67
68            virtual void changedGametype(); //!< Is called when the gametype has changed.
69
70            /**
71            @brief Set the template for the ball. (e.g. to attach the model of the ball, but also to attach an EventListener to it to detect, when it hits the boundaries, and e.g. display some ParticleEffets, when it does.)
72            @param balltemplate The name of the template to be set.
73
74            void setBalltemplate(const std::string& balltemplate)
75                { this->balltemplate_ = balltemplate; }
76            */
77
78            /**
79            @brief Get the template of the ball.
80            @return Returns the name of the template of the ball.
81
82            const std::string& getBalltemplate() const
83                { return this->balltemplate_; }
84            */
85
86            /**
87            @brief Set the template for the bats. (e.g. to attach the model of the bat, but also to attach CameraPositions to it, to be able to view the game from the bats perspective)
88            @param battemplate The name of the template to be set.
89
90            void setBattemplate(const std::string& battemplate)
91                { this->battemplate_ = battemplate; }
92            */
93
94            /**
95            @brief Set the dimensions of the playing field.
96            @param dimension A vector with the width of the playing field as first component, the height as second and the length as third.
97            */
98            void setFieldDimension(const Vector3& dimension)
99                { this->width_ = dimension.x; this->height_ = dimension.y; this->length_ = dimension.z;}
100            /**
101            @brief Get the dimensions of the playing field.
102            @return Returns a vector with the width of the playing field as first component, the height as second and the length as third.
103            */
104            Vector3 getFieldDimension() const
105                { return Vector3(this->width_, this->height_, this->length_); }
106
107
108        private:
109            void checkGametype(); //!< Checks whether the gametype is Mini4Dgame and if it is, sets its centerpoint.
110
111            //std::string balltemplate_; //!< The template for the ball.
112            //std::string battemplate_; //!< The template for the bats.
113
114            float width_; //!< The height of the playing field.
115            float height_; //!< The width of the playing field.
116            float length_; //!< The length of the playing field.
117    };
118}
119
120#endif /* _Mini4DgameCenterpoint_H__ */
Note: See TracBrowser for help on using the repository browser.