MezzanineEngine
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Mezzanine
src
Graphics
viewport.h
1
// © Copyright 2010 - 2014 BlackTopp Studios Inc.
2
/* This file is part of The Mezzanine Engine.
3
4
The Mezzanine Engine is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
The Mezzanine Engine is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
/* The original authors have included a copy of the license specified above in the
18
'Docs' folder. See 'gpl.txt'
19
*/
20
/* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21
Build professional software and charge for their product.
22
23
However there are some practical restrictions, so if your project involves
24
any of the following you should contact us and we will try to work something
25
out:
26
- DRM or Copy Protection of any kind(except Copyrights)
27
- Software Patents You Do Not Wish to Freely License
28
- Any Kind of Linking to Non-GPL licensed Works
29
- Are Currently In Violation of Another Copyright Holder's GPL License
30
- If You want to change our code and not add a few hundred MB of stuff to
31
your distribution
32
33
These and other limitations could cause serious legal problems if you ignore
34
them, so it is best to simply contact us or the Free Software Foundation, if
35
you have any questions.
36
37
Joseph Toppi - toppij@gmail.com
38
John Blackwood - makoenergy02@gmail.com
39
*/
40
#ifndef _graphicsviewport_h
41
#define _graphicsviewport_h
42
43
#include "vector2.h"
44
#include "
enumerations.h
"
45
46
namespace
Ogre
47
{
48
class
Viewport;
49
}
50
51
namespace
Mezzanine
52
{
53
namespace
Graphics
54
{
55
class
GameWindow;
56
class
CameraProxy;
57
///////////////////////////////////////////////////////////////////////////////
58
/// @class Viewport
59
/// @headerfile viewport.h
60
/// @brief This class is for creating and managing viewports within a game window.
61
/// @details A game window can contain several veiwports, and veiwports can overlap. This is
62
/// useful for editors mostly, but can be of use in games as well. Be careful about positioning
63
/// Veiwports in a game window.
64
///////////////////////////////////////
65
class
MEZZ_LIB
Viewport
66
{
67
protected
:
68
/// @internal
69
/// @brief A pointer to the internal viewport providing this classes functionality.
70
Ogre::Viewport*
OgreViewport
;
71
/// @internal
72
/// @brief A pointer to the window that created this viewport.
73
GameWindow
*
Parent
;
74
/// @internal
75
/// @brief A pointer to the camera being used to render this viewport, or NULL if one isn't set.
76
CameraProxy
*
ViewportCam
;
77
public
:
78
/// @brief Class constructor.
79
/// @param ViewportCamera The CameraProxy that is to be attached to this veiwport.
80
/// @param ZOrder The render order of this viewport relative to other viewports in the game window.
81
/// @param ParentWindow The game window this viewport belongs to.
82
Viewport
(
CameraProxy
* ViewportCamera,
const
Integer
& ZOrder,
GameWindow
* ParentWindow);
83
/// @brief Class destructor.
84
~
Viewport
();
85
86
///////////////////////////////////////////////////////////////////////////////
87
// Camera and parent Management
88
89
/// @brief Sets which CameraProxy is bound to this viewport.
90
/// @param ViewportCamera Pointer to the CameraProxy to be bount to this viewport, or NULL to simply unbind a CameraProxy.
91
void
SetCamera(
CameraProxy
* ViewportCamera);
92
/// @brief Gets the CameraProxy associated with this viewport.
93
/// @return Returns a pointer to the CameraProxy using this viewport.
94
CameraProxy
* GetViewportCamera()
const
;
95
/// @brief Gets the game window this viewport belongs to.
96
/// @return Returns a pointer to the game window that created this viewport.
97
GameWindow
* GetParentWindow()
const
;
98
99
///////////////////////////////////////////////////////////////////////////////
100
// Utility
101
102
/// @brief Gets the Zorder assigned to this viewport.
103
/// @return Returns an integer that represents this viewports rendering order in it's parent GameWindow.
104
Integer
GetZOrder()
const
;
105
/// @brief Gets the current Orientation of the viewport.
106
/// @return Returns an enum representing the current orientation of the viewport.
107
Mezzanine::OrientationMode
GetOrientationMode()
const
;
108
109
///////////////////////////////////////////////////////////////////////////////
110
// Viewport Metrics Management
111
112
/// @brief Sets the position and size of this viewport within the game window.
113
/// @param Position Vector2 of relative values(range: 0-1) representing the top left corner of the viewport.
114
/// Values are relative to the game window this viewport belongs to.
115
/// @param Size Vector2 of relative values(range: 0-1) representing the width and height of the viewport.
116
/// Values are relative to the game window this viewport belongs to.
117
void
SetDimensions(
const
Vector2
& Position,
const
Vector2
& Size);
118
/// @brief Sets the position and size of this viewport within the game window.
119
/// @param Left A relative value(range: 0-1) representing the leftmost position of the viewport.
120
/// @param Top A relative value(range: 0-1) representing the topmost position of the viewport.
121
/// @param Width A relative value(range: 0-1) representing the width of the viewport.
122
/// @param Height A relative value(range: 0-1) representing the height of the viewport.
123
void
SetDimensions(
const
Real
& Left,
const
Real
& Top,
const
Real
& Width,
const
Real
& Height);
124
/// @brief Gets the relative left position of the viewport.
125
/// @return Returns a real representing the relative left position of this veiwport.
126
Real
GetLeft()
const
;
127
/// @brief Gets the relative top position of the viewport.
128
/// @return Returns a real representing the relative top position of this veiwport.
129
Real
GetTop()
const
;
130
/// @brief Gets the relative width of the viewport.
131
/// @return Returns a real representing the relative width of this veiwport.
132
Real
GetWidth()
const
;
133
/// @brief Gets the relative height of the viewport.
134
/// @return Returns a real representing the relative height of this veiwport.
135
Real
GetHeight()
const
;
136
/// @brief Gets the left position of the viewport in pixels.
137
/// @return Returns a whole representing the left position of this veiwport in pixels.
138
Whole
GetActualLeft()
const
;
139
/// @brief Gets the top position of the viewport in pixels.
140
/// @return Returns a whole representing the top position of this veiwport in pixels.
141
Whole
GetActualTop()
const
;
142
/// @brief Gets the width of the viewport in pixels.
143
/// @return Returns a whole representing the width of this veiwport in pixels.
144
Whole
GetActualWidth()
const
;
145
/// @brief Gets the height of the viewport in pixels.
146
/// @return Returns a whole representing the height of this veiwport in pixels.
147
Whole
GetActualHeight()
const
;
148
149
///////////////////////////////////////////////////////////////////////////////
150
// Internal Methods
151
152
/// @internal
153
/// @brief Gets the internal Ogre Viewport.
154
/// @return Returns a pointer to the Ogre Viewport this class is based on.
155
Ogre::Viewport* GetOgreViewport()
const
;
156
};
//Viewport
157
}
//Graphics
158
}
//Mezzanine
159
160
#endif
Generated on Mon Jan 6 2014 20:58:05 for MezzanineEngine by
1.8.4