Skyscraper 2.0
map.cpp
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Map Object
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2025 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#include "globals.h"
25#include "sbs.h"
26#include "cameratexture.h"
27#include "timer.h"
28#include "map.h"
29
30namespace SBS {
31
32class Map::Timer : public TimerObject
33{
34public:
36 bool shot;
37 Timer(const std::string &name, Map *parent) : TimerObject(parent, name)
38 {
39 this->parent = parent;
40 shot = false;
41 }
42 virtual void Notify();
43};
44
45Map::Map(Object *parent, const std::string &name) : Object(parent)
46{
47 //set up SBS object
48 SetValues("Map", name, true);
49
50 OrthoCamera = 0;
51 enabled = false;
52
53 //create orthographic camera texture, used for map generation
54#ifdef USING_WX
55 OrthoCamera = new CameraTexture(this, "MapCamera", 3, 0, Vector3(0, 50000, 0), false, Vector3(270, 0, 0), true);
57#endif
58
59 //timer = new Timer("Map Timer", this);
60 timer = 0;
61
62 //Enabled(true);
63}
64
66{
67 if (OrthoCamera)
68 delete OrthoCamera;
69 OrthoCamera = 0;
70}
71
72void Map::Enabled(bool value)
73{
74 if (OrthoCamera)
75 OrthoCamera->Enabled(value);
76 /*if (value == true)
77 timer->Start(10000, false);
78 else
79 timer->Stop();*/
80 enabled = value;
81}
82
84{
85 return enabled;
86}
87
89{
90 /*if (parent->IsEnabled() == true && shot == false)
91 {
92 parent->Enabled(false);
93 shot = true;
94 }
95 else
96 {
97 parent->Enabled(true);
98 shot = false;
99 }*/
100}
101
102void Map::GetImage(Ogre::Image &image)
103{
104 if (OrthoCamera)
105 OrthoCamera->GetImage(image);
106}
107
108}
void EnableOrthographic(bool value)
void Enabled(bool value)
void GetImage(Ogre::Image &image)
virtual void Notify()
Definition map.cpp:88
Timer(const std::string &name, Map *parent)
Definition map.cpp:37
Map * parent
Definition map.cpp:35
Definition map.h:30
void GetImage(Ogre::Image &image)
Definition map.cpp:102
bool IsEnabled()
Definition map.cpp:83
Timer * timer
Definition map.h:49
CameraTexture * OrthoCamera
Definition map.h:44
bool enabled
Definition map.h:42
void Enabled(bool value)
Definition map.cpp:72
~Map()
Definition map.cpp:65
Map(Object *parent, const std::string &name)
Definition map.cpp:45
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
Definition object.cpp:144
Ogre::Vector3 Vector3
Definition globals.h:58