OgreEAGL2Window.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __EAGL2Window_H__
30 #define __EAGL2Window_H__
31 
32 #include "OgreRenderWindow.h"
33 
34 #ifdef __OBJC__
35 #import "OgreEAGL2View.h"
37 
38 // Forward declarations
39 @class CAEAGLLayer;
40 
41 // Define the native window type
42 typedef UIWindow *NativeWindowType;
43 
44 #endif
45 
46 namespace Ogre {
47  class EAGL2Support;
48  class EAGLES2Context;
49 
50  class _OgrePrivate EAGL2Window : public RenderWindow
51  {
52  protected:
53  bool mClosed;
54  bool mVisible;
61 
62  // iOS 4 content scaling
65 
68 #ifdef __OBJC__
69  NativeWindowType mWindow;
70  EAGL2View *mView;
71  EAGL2ViewController *mViewController;
72 #endif
73 
74  void switchFullScreen(bool fullscreen) { }
75  void getLeftAndTopFromNativeWindow(int & left, int & top, uint width, uint height);
76  void initNativeCreatedWindow(const NameValuePairList *miscParams);
77  void createNativeWindow(int &left, int &top, uint &width, uint &height, String &title);
78  void reposition(int left, int top);
79  void resize(unsigned int width, unsigned int height);
80  void windowMovedOrResized();
81  virtual void _beginUpdate();
82 
83  public:
84  EAGL2Window(EAGL2Support* glsupport);
85  virtual ~EAGL2Window();
86 
87  void create(const String& name, unsigned int width, unsigned int height,
88  bool fullScreen, const NameValuePairList *miscParams);
89 
90  virtual void setFullscreen(bool fullscreen, uint width, uint height);
91  void destroy(void);
92  bool isClosed(void) const { return mClosed; }
93  bool isVisible(void) const { return mVisible; }
94 
95  void setVisible(bool visible) { mVisible = visible; }
96  void setClosed(bool closed) { mClosed = closed; }
97  void swapBuffers();
98  void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
100 
110  virtual void getCustomAttribute(const String& name, void* pData);
111 
112  bool requiresTextureFlipping() const { return false; }
113  };
114 }
115 
116 #endif
Ogre::EAGL2Window::mVisible
bool mVisible
Definition: OgreEAGL2Window.h:54
Ogre::EAGLES2Context
Definition: OgreEAGLES2Context.h:40
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::PF_BYTE_RGBA
@ PF_BYTE_RGBA
4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
Definition: OgrePixelFormat.h:105
Ogre::RenderWindow
Manages the target rendering window.
Definition: OgreRenderWindow.h:62
Ogre::EAGL2Window::mContentScalingFactor
float mContentScalingFactor
Definition: OgreEAGL2Window.h:64
Ogre::EAGL2Window::isClosed
bool isClosed(void) const
Indicates whether the window has been closed by the user.
Definition: OgreEAGL2Window.h:92
Ogre::EAGL2Window::mGLSupport
EAGL2Support * mGLSupport
Definition: OgreEAGL2Window.h:66
Ogre::EAGL2Window::mUsingExternalViewController
bool mUsingExternalViewController
Is this using an external view controller handle?
Definition: OgreEAGL2Window.h:60
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::EAGL2Window::suggestPixelFormat
PixelFormat suggestPixelFormat() const
Override since windows don't usually have alpha.
Definition: OgreEAGL2Window.h:99
Ogre::NameValuePairList
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
EAGL2ViewController
Definition: OgreEAGL2ViewController.h:38
Ogre::EAGL2Window::isVisible
bool isVisible(void) const
Indicates whether the window is visible (not minimized or obscured)
Definition: OgreEAGL2Window.h:93
Ogre::PixelFormat
PixelFormat
The pixel format used for images, textures, and render surfaces.
Definition: OgrePixelFormat.h:43
Ogre::EAGL2Support
Definition: OgreEAGL2Support.h:53
OgreEAGL2View.h
Ogre::EAGL2Window::setVisible
void setVisible(bool visible)
Set the visibility state.
Definition: OgreEAGL2Window.h:95
OgreRenderWindow.h
Ogre::EAGL2Window::setClosed
void setClosed(bool closed)
Definition: OgreEAGL2Window.h:96
Ogre::EAGL2Window::mIsExternal
bool mIsExternal
Is this using an external window handle?
Definition: OgreEAGL2Window.h:56
Ogre::EAGL2Window::mIsContentScalingSupported
bool mIsContentScalingSupported
Definition: OgreEAGL2Window.h:63
Ogre::uint
unsigned int uint
Definition: OgrePrerequisites.h:114
Ogre::EAGL2Window::mUsingExternalView
bool mUsingExternalView
Is this using an external view handle?
Definition: OgreEAGL2Window.h:58
Ogre::PixelBox
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
Definition: OgrePixelFormat.h:304
Ogre::EAGL2Window::requiresTextureFlipping
bool requiresTextureFlipping() const
Definition: OgreEAGL2Window.h:112
Ogre::EAGL2Window::switchFullScreen
void switchFullScreen(bool fullscreen)
Definition: OgreEAGL2Window.h:74
Ogre::EAGL2Window::mClosed
bool mClosed
Definition: OgreEAGL2Window.h:53
Ogre::EAGL2Window::mContext
EAGLES2Context * mContext
Definition: OgreEAGL2Window.h:67
OgreEAGL2ViewController.h
Ogre::EAGL2Window
Definition: OgreEAGL2Window.h:50

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15