Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/include/OgreRenderWindow.h @ 5

Last change on this file since 5 was 5, checked in by anonymous, 17 years ago

=hoffentlich gehts jetzt

File size: 8.5 KB
Line 
1/*-------------------------------------------------------------------------
2This source file is a part of OGRE
3(Object-oriented Graphics Rendering Engine)
4
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This library is free software; you can redistribute it and/or modify it
11under the terms of the GNU Lesser General Public License (LGPL) as
12published by the Free Software Foundation; either version 2.1 of the
13License, or (at your option) any later version.
14
15This library is distributed in the hope that it will be useful, but
16WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
18License for more details.
19
20You should have received a copy of the GNU Lesser General Public License
21along with this library; if not, write to the Free Software Foundation,
22Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
23http://www.gnu.org/copyleft/lesser.txt
24-------------------------------------------------------------------------*/
25#ifndef __RenderWindow_H__
26#define __RenderWindow_H__
27
28#include "OgrePrerequisites.h"
29
30#include "OgreRenderTarget.h"
31
32namespace Ogre
33{
34    /** Manages the target rendering window.
35        @remarks
36            This class handles a window into which the contents
37            of a scene are rendered. There is a many-to-1 relationship
38            between instances of this class an instance of RenderSystem
39            which controls the rendering of the scene. There may be
40            more than one window in the case of level editor tools etc.
41            This class is abstract since there may be
42            different implementations for different windowing systems.
43        @remarks
44            Instances are created and communicated with by the render system
45            although client programs can get a reference to it from
46            the render system if required for resizing or moving.
47            Note that you can have multiple viewpoints
48            in the window for effects like rear-view mirrors and
49            picture-in-picture views (see Viewport and Camera).
50        @author
51            Steven Streeting
52        @version
53            1.0
54    */
55    class _OgreExport RenderWindow : public RenderTarget
56    {
57
58    public:
59        /** Default constructor.
60        */
61        RenderWindow();
62
63        /** Creates & displays the new window.
64            @param
65                width The width of the window in pixels.
66            @param
67                height The height of the window in pixels.
68            @param
69                colourDepth The colour depth in bits. Ignored if
70                fullScreen is false since the desktop depth is used.
71            @param
72                fullScreen If true, the window fills the screen,
73                with no title bar or border.
74            @param
75                left The x-position of the window. Ignored if
76                fullScreen = true.
77            @param
78                top The y-position of the window. Ignored if
79                fullScreen = true.
80            @param
81                depthBuffer Specify true to include a depth-buffer.
82            @param
83                miscParam A variable number of pointers to platform-specific arguments. The
84                actual requirements must be defined by the implementing subclasses.
85        */
86                virtual void create(const String& name, unsigned int width, unsigned int height,
87                    bool fullScreen, const NameValuePairList *miscParams) = 0;
88
89                /** Alter fullscreen mode options.
90                @note Nothing will happen unless the settings here are different from the
91                        current settings.
92                @param fullScreen Whether to use fullscreen mode or not.
93                @param width The new width to use
94                @param height The new height to use
95                */
96                virtual void setFullscreen(bool fullScreen, unsigned int width, unsigned int height) {}
97       
98        /** Destroys the window.
99        */
100        virtual void destroy(void) = 0;
101
102        /** Alter the size of the window.
103        */
104        virtual void resize(unsigned int width, unsigned int height) = 0;
105
106        /** Notify that the window has been resized
107        @remarks
108                You don't need to call this unless you created the window externally.
109        */
110        virtual void windowMovedOrResized() {}
111
112        /** Reposition the window.
113        */
114        virtual void reposition(int left, int top) = 0;
115
116        /** Indicates whether the window is visible (not minimized or obscured)
117        */
118        virtual bool isVisible(void) const { return true; }
119
120        /** Set the visibility state
121        */
122        virtual void setVisible(bool visible) {}
123
124        /** Overridden from RenderTarget, flags invisible windows as inactive
125        */
126        virtual bool isActive(void) const { return mActive && isVisible(); }
127
128        /** Indicates whether the window has been closed by the user.
129        */
130        virtual bool isClosed(void) const = 0;
131       
132        /** Indicates wether the window is the primary window. The
133                primary window is special in that it is destroyed when
134                ogre is shut down, and cannot be destroyed directly.
135                This is the case because it holds the context for vertex,
136                index buffers and textures.
137        */
138        virtual bool isPrimary(void) const;
139
140        /** Swaps the frame buffers to display the next frame.
141            @remarks
142                All render windows are double-buffered so that no
143                'in-progress' versions of the scene are displayed
144                during rendering. Once rendering has completed (to
145                an off-screen version of the window) the buffers
146                are swapped to display the new frame.
147
148            @param
149                waitForVSync If true, the system waits for the
150                next vertical blank period (when the CRT beam turns off
151                as it travels from bottom-right to top-left at the
152                end of the pass) before flipping. If false, flipping
153                occurs no matter what the beam position. Waiting for
154                a vertical blank can be slower (and limits the
155                framerate to the monitor refresh rate) but results
156                in a steadier image with no 'tearing' (a flicker
157                resulting from flipping buffers when the beam is
158                in the progress of drawing the last frame).
159        */
160        virtual void swapBuffers(bool waitForVSync = true) = 0;
161
162                /// @copydoc RenderTarget::update
163        virtual void update(void);
164        /** Updates the window contents.
165            @remarks
166                The window is updated by telling each camera which is supposed
167                to render into this window to render it's view, and then
168                the window buffers are swapped via swapBuffers() if requested
169                        @param swapBuffers If set to true, the window will immediately
170                                swap it's buffers after update. Otherwise, the buffers are
171                                not swapped, and you have to call swapBuffers yourself sometime
172                                later. You might want to do this on some rendersystems which
173                                pause for queued rendering commands to complete before accepting
174                                swap buffers calls - so you could do other CPU tasks whilst the
175                                queued commands complete. Or, you might do this if you want custom
176                                control over your windows, such as for externally created windows.
177        */
178        virtual void update(bool swapBuffers);
179
180        /** Returns true if window is running in fullscreen mode.
181        */
182        virtual bool isFullScreen(void) const;
183
184        /** Overloaded version of getMetrics from RenderTarget, including extra details
185            specific to windowing systems.
186        */
187        virtual void getMetrics(unsigned int& width, unsigned int& height, unsigned int& colourDepth, 
188                        int& left, int& top);
189
190    protected:
191        bool mIsFullScreen;
192        bool mIsPrimary;
193        int mLeft;
194        int mTop;
195       
196        /** Indicates that this is the primary window. Only to be called by
197            Ogre::Root
198        */
199        void _setPrimary() { mIsPrimary = true; }
200       
201        friend class Root;
202    };
203
204    /** Defines the interface a DLL implemeting a platform-specific version must implement.
205        @remarks
206            Any library (.dll, .so) wishing to implement a platform-specific version of this
207            dialog must export the symbol 'createRenderWindow' with the signature
208            void createPlatformRenderWindow(RenderWindow** ppDlg)
209    */
210    typedef void (*DLL_CREATERENDERWINDOW)(RenderWindow** ppWindow);
211
212} // Namespace
213#endif
Note: See TracBrowser for help on using the repository browser.