OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Plus/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 
39 @class CocoaWindowDelegate;
40 
41 @interface OgreGL3PlusWindow : NSWindow
42 
43 @end
44 
45 namespace Ogre {
46  class _OgreGL3PlusExport CocoaWindow : public RenderWindow
47  {
48  private:
49  NSWindow *mWindow;
50  NSView *mView;
51  NSOpenGLContext *mGLContext;
52  NSOpenGLPixelFormat *mGLPixelFormat;
53  CVDisplayLinkRef mDisplayLink;
54  NSPoint mWindowOrigin;
55  CocoaWindowDelegate *mWindowDelegate;
56  CocoaContext* mContext;
57 
58  bool mActive;
59  bool mClosed;
60  bool mHidden;
61  bool mVSync;
62  bool mHasResized;
63  bool mIsExternal;
64  String mWindowTitle;
65  bool mUseNSView;
66  float mContentScalingFactor;
67 
68  void _setWindowParameters(void);
69  public:
70  CocoaWindow();
71  ~CocoaWindow();
72 
73  NSView* ogreView() const { return mView; };
74  NSWindow* ogreWindow() const { return mWindow; };
75  NSOpenGLContext* nsopenGLContext() const { return mGLContext; };
76  void createWithView(OgreGL3PlusView *view);
77 
78  void create(const String& name, unsigned int width, unsigned int height,
79  bool fullScreen, const NameValuePairList *miscParams);
81  void destroy(void);
83  bool isActive(void) const;
85  bool isClosed(void) const;
87  bool isHidden(void) const { return mHidden; }
89  void setHidden(bool hidden);
91  void setVSyncEnabled(bool vsync);
93  bool isVSyncEnabled() const;
95  void reposition(int left, int top);
97  void resize(unsigned int width, unsigned int height);
99  void swapBuffers();
101  virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
103  virtual void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
105  virtual unsigned int getWidth(void) const;
107  virtual unsigned int getHeight(void) const;
109  void windowMovedOrResized(void);
110  void windowResized(void);
111  void windowHasResized(void);
112  void createNewWindow(unsigned int width, unsigned int height, String title);
113  void createWindowFromExternal(NSView *viewRef);
114 
115  bool requiresTextureFlipping() const { return false; }
116  void getCustomAttribute( const String& name, void* pData );
117  };
118 }
119 
120 #endif
121 
Manages the target rendering window.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
#define _OgreGL3PlusExport
_StringBase String
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.