Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gui/src/orxonox/objects/Ambient.cc @ 1952

Last change on this file since 1952 was 1694, checked in by rgrieder, 16 years ago

Added Dedicated game state (name: "dedicated", class: GSDedicated).
It doesn't work at all yet, mainly because of our very poorly designed /objects folder. I tried adding a few "if (Settings::showsGraphics())", but I ran into some serious issues.
I will simply leave this topic up to an eager orxonox developer who wants a dedicated server :D There is A LOT of work to be done…

  • Property svn:eol-style set to native
File size: 2.7 KB
RevLine 
[1505]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 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "OrxonoxStableHeaders.h"
30#include "Ambient.h"
31
32#include <vector>
33#include <string>
34
35#include <OgreSceneManager.h>
36
37#include "tinyxml/tinyxml.h"
38#include "util/SubString.h"
39#include "util/Convert.h"
40#include "util/Math.h"
41#include "core/Debug.h"
42#include "core/CoreIncludes.h"
43#include "GraphicsEngine.h"
44#include "core/XMLPort.h"
45#include "core/ConsoleCommand.h"
[1694]46#include "Settings.h"
[1505]47
48namespace orxonox
49{
50    SetConsoleCommand(Ambient, setAmbientLightTest, false).setDefaultValues(ColourValue(1, 1, 1, 1)).setAccessLevel(AccessLevel::Offline);
51
52    CreateFactory(Ambient);
53
54    Ambient* Ambient::instance_s;
55
56    Ambient::Ambient()
57    {
58        RegisterObject(Ambient);
59        Ambient::instance_s = this;
60        registerAllVariables();
61    }
62
63    Ambient::~Ambient()
64    {
65    }
66
67    bool Ambient::create(){
[1694]68        if (Settings::showsGraphics())
69            GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(ambientLight_);
70        return Synchronisable::create();
[1505]71    }
[1694]72
[1505]73    void Ambient::registerAllVariables(){
[1694]74        registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);
75
[1505]76    }
[1625]77
78    void Ambient::setAmbientLight(const ColourValue& colour)
[1505]79    {
[1694]80        if (Settings::showsGraphics())
81            GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour);
82        ambientLight_=colour;   
[1625]83    }
[1505]84
85    /**
[1694]86    @brief
87        XML loading and saving.
88    @param
89        xmlelement The XML-element
90    @param
91        loading Loading (true) or saving (false)
92    @return
93        The XML-element
[1505]94    */
95    void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode)
96    {
97        BaseObject::XMLPort(xmlelement, mode);
98
99        XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode);
100        create();
101    }
102}
Note: See TracBrowser for help on using the repository browser.