Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AppCocoaView.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012, The Cinder Project, All rights reserved.
3 
4  This code is intended for use with the Cinder C++ library: http://libcinder.org
5 
6  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
7  the following conditions are met:
8 
9  * Redistributions of source code must retain the above copyright notice, this list of conditions and
10  the following disclaimer.
11  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12  the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
15  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
16  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
17  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
18  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21  POSSIBILITY OF SUCH DAMAGE.
22 */
23 
24 #pragma once
25 
26 #include "cinder/app/App.h"
27 
28 #if defined( __OBJC__ )
29  @class AppImplCocoaView;
30  @class CinderView;
31 #else
32  class AppImplCocoaView;
33  class CinderView;
34 #endif
35 
36 namespace cinder { namespace app {
37 
38 class AppCocoaView : public App {
39  public:
40  class Settings : public App::Settings {
41  public:
42  Settings();
43 
44  private:
45  };
46 
47  AppCocoaView();
48 
49  virtual void prepareSettings( Settings *settings ) {}
50 
51  void prepareLaunch( RendererRef defaultRenderer = RendererRef() );
52  virtual void setupCinderView( CinderView *cinderView, RendererRef renderer );
53  virtual void launch( const char *title = 0, int argc = 0, char * const argv[] = 0 );
54 
55  virtual void quit() override;
56 
57 
58  virtual const Settings& getSettings() const override { return mSettings; }
59 
61  virtual float getFrameRate() const override;
63  virtual void setFrameRate( float frameRate ) override;
65  void disableFrameRate();
67  bool isFrameRateEnabled() const;
68 
69  virtual fs::path getAppPath() const override;
70  virtual size_t getNumWindows() const override;
71  virtual WindowRef getWindow() const override;
72  virtual WindowRef getWindowIndex( size_t index ) const override;
73 
74  protected:
76  AppImplCocoaView *mImpl;
77 };
78 
79 } } // cinder::app
AppImplCocoaView * mImpl
Definition: AppCocoaView.h:76
void prepareLaunch(RendererRef defaultRenderer=RendererRef())
Definition: AppCocoaView.mm:514
virtual void setupCinderView(CinderView *cinderView, RendererRef renderer)
Definition: AppCocoaView.mm:521
virtual void quit() override
Quits the application gracefully.
Definition: AppCocoaView.mm:545
Definition: App.h:129
Definition: AppCocoaView.h:40
GLuint index
Definition: GLee.h:2259
Definition: AppCocoaView.h:38
virtual fs::path getAppPath() const override
Returns the path to the application on disk.
Definition: AppCocoaView.mm:570
std::shared_ptr< Window > WindowRef
Definition: Event.h:49
Definition: App.h:127
virtual WindowRef getWindowIndex(size_t index) const override
Gets a Window by index, in the range [0, getNumWindows()). Throw ExcInvalidWindow if index is out of ...
Definition: AppCocoaView.mm:588
std::shared_ptr< class Renderer > RendererRef
Definition: Renderer.h:85
virtual void prepareSettings(Settings *settings)
Definition: AppCocoaView.h:49
virtual void launch(const char *title=0, int argc=0, char *const argv[]=0)
Definition: AppCocoaView.mm:527
Settings()
Definition: AppCocoaView.mm:509
virtual void setFrameRate(float frameRate) override
Sets the maximum frame-rate the App will attempt to maintain \ a frameRate frames-per-second.
Definition: AppCocoaView.mm:555
virtual const Settings & getSettings() const override
Definition: AppCocoaView.h:58
void disableFrameRate()
Disables frameRate limiting.
Definition: AppCocoaView.mm:560
Settings mSettings
Definition: AppCocoaView.h:75
virtual float getFrameRate() const override
Returns the maximum frame-rate the App will attempt to maintain measured in frames-per-second.
Definition: AppCocoaView.mm:550
virtual size_t getNumWindows() const override
Returns the number of Windows the app has open.
Definition: AppCocoaView.mm:578
bool isFrameRateEnabled() const
Returns whether frameRate limiting is enabled.
Definition: AppCocoaView.mm:565
Definition: CinderView.h:54
AppCocoaView()
Definition: AppCocoaView.mm:504
virtual WindowRef getWindow() const override
Returns the the currently active Window. Throws ExcInvalidWindow if called with no active window...
Definition: AppCocoaView.mm:583