00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org 00006 00007 Copyright (c) 2000-2012 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 00029 #ifndef __OSXCocoaWindow_H__ 00030 #define __OSXCocoaWindow_H__ 00031 00032 #include "OgreOSXCocoaContext.h" 00033 00034 #include <Cocoa/Cocoa.h> 00035 #include "OgreOSXCocoaView.h" 00036 #include "OgreOSXCocoaWindowDelegate.h" 00037 00038 @class OSXCocoaWindowDelegate; 00039 00040 @interface OgreWindow : NSWindow 00041 00042 @end 00043 00044 namespace Ogre { 00045 class _OgreGLExport OSXCocoaWindow : public RenderWindow 00046 { 00047 private: 00048 NSWindow *mWindow; 00049 NSView *mView; 00050 NSOpenGLContext *mGLContext; 00051 NSOpenGLPixelFormat *mGLPixelFormat; 00052 NSPoint mWindowOrigin; 00053 OSXCocoaWindowDelegate *mWindowDelegate; 00054 OSXCocoaContext* mContext; 00055 00056 bool mActive; 00057 bool mClosed; 00058 bool mHidden; 00059 bool mVSync; 00060 bool mHasResized; 00061 bool mIsExternal; 00062 String mWindowTitle; 00063 bool mUseNSView; 00064 00065 void _setWindowParameters(void); 00066 public: 00067 OSXCocoaWindow(); 00068 ~OSXCocoaWindow(); 00069 00070 NSView* ogreView() const { return mView; }; 00071 NSWindow* ogreWindow() const { return mWindow; }; 00072 NSOpenGLContext* nsopenGLContext() const { return mGLContext; }; 00073 NSOpenGLPixelFormat* nsopenGLPixelFormat() const { return mGLPixelFormat; }; 00074 void createWithView(OgreView *view); 00075 00076 void create(const String& name, unsigned int width, unsigned int height, 00077 bool fullScreen, const NameValuePairList *miscParams); 00079 void destroy(void); 00081 bool isActive(void) const; 00083 bool isClosed(void) const; 00085 bool isHidden(void) const { return mHidden; } 00087 void setHidden(bool hidden); 00089 void setVSyncEnabled(bool vsync); 00091 bool isVSyncEnabled() const; 00093 void reposition(int left, int top); 00095 void resize(unsigned int width, unsigned int height); 00097 void swapBuffers(bool waitForVSync); 00099 virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer); 00101 virtual void setFullscreen(bool fullScreen, unsigned int width, unsigned int height); 00103 void windowMovedOrResized(void); 00104 void windowResized(void); 00105 void windowHasResized(void); 00106 void createNewWindow(unsigned int width, unsigned int height, String title); 00107 void createWindowFromExternal(NSView *viewRef); 00108 00109 bool requiresTextureFlipping() const { return false; } 00110 void getCustomAttribute( const String& name, void* pData ); 00111 }; 00112 } 00113 00114 #endif 00115
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:22