Skyscraper
2.0
src
sbs
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
30
namespace
SBS
{
31
32
class
Map::Timer
:
public
TimerObject
33
{
34
public
:
35
Map
*
parent
;
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
45
Map::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
);
56
OrthoCamera
->
EnableOrthographic
(
true
);
57
#endif
58
59
//timer = new Timer("Map Timer", this);
60
timer
= 0;
61
62
//Enabled(true);
63
}
64
65
Map::~Map
()
66
{
67
if
(
OrthoCamera
)
68
delete
OrthoCamera
;
69
OrthoCamera
= 0;
70
}
71
72
void
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
83
bool
Map::IsEnabled
()
84
{
85
return
enabled
;
86
}
87
88
void
Map::Timer::Notify
()
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
102
void
Map::GetImage
(Ogre::Image &image)
103
{
104
if
(
OrthoCamera
)
105
OrthoCamera
->
GetImage
(image);
106
}
107
108
}
cameratexture.h
SBS::CameraTexture
Definition
cameratexture.h:30
SBS::CameraTexture::EnableOrthographic
void EnableOrthographic(bool value)
Definition
cameratexture.cpp:209
SBS::CameraTexture::Enabled
void Enabled(bool value)
Definition
cameratexture.cpp:162
SBS::CameraTexture::GetImage
void GetImage(Ogre::Image &image)
Definition
cameratexture.cpp:222
SBS::Map::Timer
Definition
map.cpp:33
SBS::Map::Timer::shot
bool shot
Definition
map.cpp:36
SBS::Map::Timer::Notify
virtual void Notify()
Definition
map.cpp:88
SBS::Map::Timer::Timer
Timer(const std::string &name, Map *parent)
Definition
map.cpp:37
SBS::Map::Timer::parent
Map * parent
Definition
map.cpp:35
SBS::Map
Definition
map.h:30
SBS::Map::GetImage
void GetImage(Ogre::Image &image)
Definition
map.cpp:102
SBS::Map::IsEnabled
bool IsEnabled()
Definition
map.cpp:83
SBS::Map::timer
Timer * timer
Definition
map.h:49
SBS::Map::OrthoCamera
CameraTexture * OrthoCamera
Definition
map.h:44
SBS::Map::enabled
bool enabled
Definition
map.h:42
SBS::Map::Enabled
void Enabled(bool value)
Definition
map.cpp:72
SBS::Map::~Map
~Map()
Definition
map.cpp:65
SBS::Map::Map
Map(Object *parent, const std::string &name)
Definition
map.cpp:45
SBS::Object
Definition
object.h:56
SBS::Object::SetValues
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
Definition
object.cpp:144
SBS::TimerObject
Definition
timer.h:30
globals.h
Vector3
Ogre::Vector3 Vector3
Definition
globals.h:58
map.h
SBS
Definition
skyscraper.h:45
sbs.h
timer.h
Generated by
1.11.0