OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2014 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 #include "OgrePixelBox.h"
39 
41 
42 @interface OgreWindow : NSWindow
43 
44 @end
45 
46 namespace Ogre {
47 
48  class _OgreGLExport OSXCocoaWindow : public RenderWindow
49  {
50  private:
51  NSWindow *mWindow;
52  NSView *mView;
53  NSOpenGLContext *mGLContext;
54  NSOpenGLPixelFormat *mGLPixelFormat;
55  NSPoint mWindowOrigin;
56  OSXCocoaWindowDelegate *mWindowDelegate;
57  OSXCocoaContext* mContext;
58 
59  bool mActive;
60  bool mClosed;
61  bool mHidden;
62  bool mVSync;
63  bool mHasResized;
64  bool mIsExternal;
65  String mWindowTitle;
66  bool mUseNSView;
67  float mContentScalingFactor;
68  bool mContentScalingSupported;
69 
70  void _setWindowParameters(void);
71  public:
72  OSXCocoaWindow();
73  ~OSXCocoaWindow();
74 
75  NSView* ogreView() const { return mView; };
76  NSWindow* ogreWindow() const { return mWindow; };
77  NSOpenGLContext* nsopenGLContext() const { return mGLContext; };
78  NSOpenGLPixelFormat* nsopenGLPixelFormat() const { return mGLPixelFormat; };
79  void createWithView(OgreView *view);
80 
81  void create(const String& name, unsigned int width, unsigned int height,
82  bool fullScreen, const NameValuePairList *miscParams);
84  void destroy(void);
86  bool isActive(void) const;
88  bool isClosed(void) const;
90  bool isHidden(void) const { return mHidden; }
92  void setHidden(bool hidden);
94  void setVSyncEnabled(bool vsync);
96  bool isVSyncEnabled() const;
98  void reposition(int left, int top);
100  void resize(unsigned int width, unsigned int height);
102  void swapBuffers();
104  virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
106  virtual void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
108  virtual unsigned int getWidth(void) const;
110  virtual unsigned int getHeight(void) const;
112  void windowMovedOrResized(void);
113  void windowResized(void);
114  void windowHasResized(void);
115  void createNewWindow(unsigned int width, unsigned int height, String title);
116  void createWindowFromExternal(NSView *viewRef);
117 
118  bool requiresTextureFlipping() const { return false; }
119  void getCustomAttribute( const String& name, void* pData );
120  };
121 }
122 
123 #endif
124 
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:580
#define _OgreGLExport
_StringBase String
Definition: OgreCommon.h:53