include/OSX/OgreOSXCocoaWindow.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 __OSXCocoaWindow_H__
30 #define __OSXCocoaWindow_H__
31 
32 #include "OgreOSXCocoaContext.h"
33 
34 #include <AppKit/NSWindow.h>
35 #include <QuartzCore/CVDisplayLink.h>
36 #include "OgreOSXCocoaView.h"
38 
40 
41 @interface OgreWindow : NSWindow
42 
43 @end
44 
45 namespace Ogre {
46 
48  {
49  private:
50  NSWindow *mWindow;
51  NSView *mView;
52  NSOpenGLContext *mGLContext;
53  NSOpenGLPixelFormat *mGLPixelFormat;
54  NSPoint mWindowOrigin;
57 
58  bool mActive;
59  bool mClosed;
60  bool mHidden;
61  bool mVSync;
65  bool mUseNSView;
68 
69  void _setWindowParameters(void);
70  public:
72  ~OSXCocoaWindow();
73 
74  NSView* ogreView() const { return mView; };
75  NSWindow* ogreWindow() const { return mWindow; };
76  NSOpenGLContext* nsopenGLContext() const { return mGLContext; };
77  NSOpenGLPixelFormat* nsopenGLPixelFormat() const { return mGLPixelFormat; };
78  void createWithView(OgreView *view);
79 
80  void create(const String& name, unsigned int width, unsigned int height,
81  bool fullScreen, const NameValuePairList *miscParams);
83  void destroy(void);
85  bool isActive(void) const;
87  bool isClosed(void) const;
89  bool isHidden(void) const { return mHidden; }
91  void setHidden(bool hidden);
93  void setVSyncEnabled(bool vsync);
95  bool isVSyncEnabled() const;
97  void reposition(int left, int top);
99  void resize(unsigned int width, unsigned int height);
101  void swapBuffers();
103  virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
105  virtual void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
107  virtual unsigned int getWidth(void) const;
109  virtual unsigned int getHeight(void) const;
111  void windowMovedOrResized(void);
112  void windowResized(void);
113  void windowHasResized(void);
114  void createNewWindow(unsigned int width, unsigned int height, String title);
115  void createWindowFromExternal(NSView *viewRef);
116 
117  bool requiresTextureFlipping() const { return false; }
118  void getCustomAttribute( const String& name, void* pData );
119  };
120 }
121 
122 #endif
123 
Ogre::OSXCocoaWindow::mActive
bool mActive
Definition: include/OSX/OgreOSXCocoaWindow.h:58
Ogre::OSXCocoaWindow::mWindow
NSWindow * mWindow
Definition: include/OSX/OgreOSXCocoaWindow.h:50
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::OSXCocoaWindow::requiresTextureFlipping
bool requiresTextureFlipping() const
Definition: include/OSX/OgreOSXCocoaWindow.h:117
Ogre::RenderWindow
Manages the target rendering window.
Definition: OgreRenderWindow.h:62
Ogre::OSXCocoaWindow::ogreWindow
NSWindow * ogreWindow() const
Definition: include/OSX/OgreOSXCocoaWindow.h:75
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::NameValuePairList
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
Ogre::OSXCocoaWindow::nsopenGLContext
NSOpenGLContext * nsopenGLContext() const
Definition: include/OSX/OgreOSXCocoaWindow.h:76
Ogre::OSXCocoaWindow::mIsExternal
bool mIsExternal
Definition: include/OSX/OgreOSXCocoaWindow.h:63
Ogre::OSXCocoaWindow::mVSync
bool mVSync
Definition: include/OSX/OgreOSXCocoaWindow.h:61
Ogre::OSXCocoaWindow::mContentScalingFactor
float mContentScalingFactor
Definition: include/OSX/OgreOSXCocoaWindow.h:66
Ogre::OSXCocoaWindow::mUseNSView
bool mUseNSView
Definition: include/OSX/OgreOSXCocoaWindow.h:65
_OgreGLExport
#define _OgreGLExport
Definition: OgreGLPrerequisites.h:99
Ogre::OSXCocoaWindow
Definition: include/OSX/OgreOSXCocoaWindow.h:47
OgreOSXCocoaWindowDelegate.h
OSXCocoaWindowDelegate
Definition: include/OSX/OgreOSXCocoaWindowDelegate.h:33
Ogre::OSXCocoaWindow::mHasResized
bool mHasResized
Definition: include/OSX/OgreOSXCocoaWindow.h:62
Ogre::OSXCocoaWindow::mGLContext
NSOpenGLContext * mGLContext
Definition: include/OSX/OgreOSXCocoaWindow.h:52
Ogre::OSXCocoaWindow::mHidden
bool mHidden
Definition: include/OSX/OgreOSXCocoaWindow.h:60
OgreOSXCocoaContext.h
OgreOSXCocoaView.h
OgreWindow
Definition: OgreOSXCocoaTouchView.h:50
Ogre::PixelBox
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
Definition: OgrePixelFormat.h:304
Ogre::OSXCocoaWindow::mWindowTitle
String mWindowTitle
Definition: include/OSX/OgreOSXCocoaWindow.h:64
Ogre::OSXCocoaWindow::mContext
OSXCocoaContext * mContext
Definition: include/OSX/OgreOSXCocoaWindow.h:56
Ogre::OSXCocoaWindow::mWindowDelegate
OSXCocoaWindowDelegate * mWindowDelegate
Definition: include/OSX/OgreOSXCocoaWindow.h:55
Ogre::OSXCocoaWindow::isHidden
bool isHidden(void) const
RenderWindow::isHidden
Definition: include/OSX/OgreOSXCocoaWindow.h:89
Ogre::OSXCocoaWindow::nsopenGLPixelFormat
NSOpenGLPixelFormat * nsopenGLPixelFormat() const
Definition: include/OSX/OgreOSXCocoaWindow.h:77
Ogre::OSXCocoaWindow::mClosed
bool mClosed
Definition: include/OSX/OgreOSXCocoaWindow.h:59
Ogre::OSXCocoaWindow::mGLPixelFormat
NSOpenGLPixelFormat * mGLPixelFormat
Definition: include/OSX/OgreOSXCocoaWindow.h:53
Ogre::OSXCocoaWindow::ogreView
NSView * ogreView() const
Definition: include/OSX/OgreOSXCocoaWindow.h:74
Ogre::OSXCocoaContext
Definition: include/OSX/OgreOSXCocoaContext.h:36
Ogre::OSXCocoaWindow::mView
NSView * mView
Definition: include/OSX/OgreOSXCocoaWindow.h:51
Ogre::OSXCocoaWindow::mWindowOrigin
NSPoint mWindowOrigin
Definition: include/OSX/OgreOSXCocoaWindow.h:54
Ogre::OSXCocoaWindow::mContentScalingSupported
bool mContentScalingSupported
Definition: include/OSX/OgreOSXCocoaWindow.h:67
OgreView
Definition: OgreOSXCocoaTouchView.h:35

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