Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Friends
cinder::app::App Class Reference

#import <App.h>

List of all members.

Classes

class  Settings

Public Member Functions

() - App
(virtual) - ~App
(virtual void) - setup
 Override to perform any application setup after the Renderer has been initialized.
(virtual void) - shutdown
 Override to perform any application cleanup before exiting.
(virtual void) - update
 Override to perform any once-per-loop computation.
(virtual void) - draw
 Override to perform any rendering once-per-loop or in response to OS-prompted requests for refreshes.
(virtual void) - mouseDown
 Override to receive mouse-down events.
(virtual void) - mouseUp
 Override to receive mouse-up events.
(virtual void) - mouseWheel
 Override to receive mouse-wheel events.
(virtual void) - mouseMove
 Override to receive mouse-move events.
(virtual void) - mouseDrag
 Override to receive mouse-drag events.
(virtual void) - touchesBegan
 Override to respond to the beginning of a multitouch sequence.
(virtual void) - touchesMoved
 Override to respond to movement (drags) during a multitouch sequence.
(virtual void) - touchesEnded
 Override to respond to the end of a multitouch sequence.
(virtual void) - keyDown
 Override to receive key-down events.
(virtual void) - keyUp
 Override to receive key-up events.
(virtual void) - resize
 Override to receive window resize events.
(virtual void) - fileDrop
 Override to receive file-drop events.
(virtual void) - quit
 Quits the application gracefully.
(signals::signal< void()> &) - getSignalUpdate
 Emitted at the start of each application update cycle.
(signals::signal< void()> &) - getSignalShutdown
 Emitted prior to the application shutting down.
(void) - emitShutdown
(const std::vector
< TouchEvent::Touch > &) 
- getActiveTouches
(virtual const Settings &) - getSettings
(RendererRef- getRenderer
 Returns the Renderer of the active Window.
(DisplayRef- getDisplay
 Returns the Display of the active Window.
(virtual WindowRef- getWindow
 Returns the the currently active Window. Throws ExcInvalidWindow if called with no active window.
(virtual size_t) - getNumWindows
 Returns the number of Windows the app has open.
(virtual WindowRef- getWindowIndex
 Gets a Window by index, in the range [0, getNumWindows). Throw ExcInvalidWindow if index is out of bounds.
(virtual void) - enablePowerManagement
 a value of true allows screensavers or the system's power management to hide the app. Default value is false on desktop, and true on mobile
(virtual bool) - isPowerManagementEnabled
 is power management enabled, allowing screensavers and the system's power management to hide the application
(int) - getWindowWidth
 Returns the width of the App's current window measured in points.
(int) - getWindowHeight
 Returns the height of the App's current window measured in points.
(void) - setWindowSize
 Sets the size of the App's current window measured in points. Ignored in full-screen mode.
(void) - setWindowSize
 Sets the size of the App's window measured in points. Ignored in full-screen mode.
(Vec2f- getWindowCenter
 Returns the center of the App's window measured in points.
(Vec2i- getWindowSize
 Returns the size of the App's current window measured in points.
(float) - getWindowAspectRatio
 Returns the aspect ratio of the App's current window.
(Area- getWindowBounds
 Returns the bounding area of the App's current window measured in points.
(float) - getWindowContentScale
 Returns the contentScale of the App's window, which is the multiplier that maps points to pixels.
(Vec2i- getWindowPos
 Returns tcoordinates of the top-left corner of the current window measured in points.
(int) - getWindowPosX
 Returns the X coordinate of the top-left corner of the current window measured in points.
(int) - getWindowPosY
 Returns the Y coordinate of the top-left corner of the current window contents measured in points.
(void) - setWindowPos
 Sets the coordinates of the top-left corner of the current window measured in points.
(virtual void) - setWindowPos
 Sets the coordinates of the top-left corner of the current window measured points.
(virtual float) - getFrameRate
 Returns the maximum frame-rate the App will attempt to maintain.
(virtual void) - setFrameRate
 Sets the maximum frame-rate the App will attempt to maintain.
(float) - getAverageFps
 Returns the average frame-rate attained by the App as measured in frames-per-second.
(double) - getFpsSampleInterval
 Returns the sampling rate in seconds for measuring the average frame-per-second as returned by getAverageFps
(void) - setFpsSampleInterval
 Sets the sampling rate in seconds for measuring the average frame-per-second as returned by getAverageFps
(bool) - isFullScreen
 Returns whether the App is in full-screen mode or not.
(void) - setFullScreen
 Sets whether the active App is in full-screen mode based on fullScreen.
(double) - getElapsedSeconds
 Returns the number of seconds which have elapsed since application launch.
(uint32_t) - getElapsedFrames
 Returns the number of animation frames which have elapsed since application launch.
(DataSourceRef- loadAsset
 Returns a DataSourceRef to an application asset. Throws a AssetLoadExc on failure.
(fs::path) - getAssetPath
 Returns a fs::path to an application asset. Returns an empty path on failure.
(void) - addAssetDirectory
 Adds an absolute path 'dirPath' to the list of directories which are searched for assets.
(virtual fs::path) - getAppPath
 Returns the path to the application on disk.
(virtual NSBundle *) - getBundle
 Returns the application's bundle (.app) or a screenSaver's bundle (.saver) for AppScreenSaver.
(fs::path) - getOpenFilePath
 Presents the user with a file-open dialog and returns the selected file path.
(fs::path) - getFolderPath
 Presents the user with a folder-open dialog and returns the selected folder.
(fs::path) - getSaveFilePath
 Presents the user with a file-save dialog and returns the selected file path.
(std::ostream &) - console
 Returns a reference to an output console, which is an alias to std::cout on the mac, and a wrapper around OutputDebugString on MSW.
(Timeline &) - timeline
 Returns a reference to the App's Timeline.
(boost::asio::io_service &) - io_service
 Returns a reference to the App's boost::asio::io_service()
(void) - dispatchAsync
 Executes a std::function on the App's primary thread ahead of the next update
template<typename T >
(std::result_of< T()>::type) - dispatchSync
(RendererRef- getDefaultRenderer
 Returns the default Renderer which will be used when creating a new Window. Set by the app instantiation macro automatically.
(Surface- copyWindowSurface
(Surface- copyWindowSurface
(void) - restoreWindowContext
 Restores the current rendering context to be the App's window or the screen in full-screen mode. Generally this is only necessary if the app has displayed a dialog box or some other external window.
(RendererRef- findSharedRenderer
 Finds any Renderer of the same type as searchRenderer among existing windows. This is generally not necessary and used to enable context sharing between Windows. Returns NULL on failure.
(virtual bool) - getsWindowsPaintEvents
(virtual bool) - receivesEvents

Static Public Member Functions

(static Vec2i+ getMousePos
 Returns the current location of the mouse in screen coordinates measured in points. Can be called outside the normal event loop.
(static DataSourceRef+ loadResource
 Returns a DataSourceRef to an application resource. On Mac OS X, macPath is a path relative to the bundle's resources folder. On Windows, mswID and mswType identify the resource as defined the application's .rc file(s). Throws ResourceLoadExc on failure.
(static DataSourceRef+ loadResource
 Returns a DataSourceRef to an application resource. macPath is a path relative to the bundle's resources folder. Throws ResourceLoadExc on failure.
(static fs::path) + getResourcePath
 Returns the absolute file path to a resource located at rsrcRelativePath inside the bundle's resources folder. Throws ResourceLoadExc on failure.
(static fs::path) + getResourcePath
 Returns the absolute file path to the bundle's resources folder.
(static DataSourceRef+ loadResource
 Returns a DataSourceRef to an application resource. mswID and mswType identify the resource as defined the application's .rc file(s).
(static bool) + isPrimaryThread
 Return true if the calling thread is the Application's primary thread.
(static App *) + get
 Returns a pointer to the active App.

Protected Attributes

std::shared_ptr< std::ostream > mOutputStream
RendererRef mDefaultRenderer
bool mPowerManagement

Static Protected Attributes

static AppsInstance

Friends

class AppImplMsw

Constructor & Destructor Documentation

- cinder:
- (virtual) app:

Member Function Documentation

- (virtual void) app:

Override to perform any application setup after the Renderer has been initialized.

- (virtual void) app:

Override to perform any application cleanup before exiting.

- (virtual void) app:

Override to perform any once-per-loop computation.

- (virtual void) app:

Override to perform any rendering once-per-loop or in response to OS-prompted requests for refreshes.

- (virtual void) app: (MouseEvent event

Override to receive mouse-down events.

- (virtual void) app: (MouseEvent event

Override to receive mouse-up events.

- (virtual void) app: (MouseEvent event

Override to receive mouse-wheel events.

- (virtual void) app: (MouseEvent event

Override to receive mouse-move events.

- (virtual void) app: (MouseEvent event

Override to receive mouse-drag events.

- (virtual void) app: (TouchEvent event

Override to respond to the beginning of a multitouch sequence.

- (virtual void) app: (TouchEvent event

Override to respond to movement (drags) during a multitouch sequence.

- (virtual void) app: (TouchEvent event

Override to respond to the end of a multitouch sequence.

- (virtual void) app: (KeyEvent event

Override to receive key-down events.

- (virtual void) app: (KeyEvent event

Override to receive key-up events.

- (virtual void) app:

Override to receive window resize events.

- (virtual void) app: (FileDropEvent event

Override to receive file-drop events.

- (virtual void) app:

Quits the application gracefully.

- signals:

Emitted at the start of each application update cycle.

- signals:

Emitted prior to the application shutting down.

- (void) app:
- (const vector<)TouchEvent: const
- (virtual const Settings&) app: const
- (RendererRef) app: const

Returns the Renderer of the active Window.

- (DisplayRef) app: const

Returns the Display of the active Window.

- (virtual WindowRef) app: const

Returns the the currently active Window. Throws ExcInvalidWindow if called with no active window.

- (virtual size_t) app: const

Returns the number of Windows the app has open.

- (virtual WindowRef) app: (size_t)  index const

Gets a Window by index, in the range [0, getNumWindows). Throw ExcInvalidWindow if index is out of bounds.

- (virtual void) app: (bool)  powerManagement = true

a value of true allows screensavers or the system's power management to hide the app. Default value is false on desktop, and true on mobile

- (virtual bool) app: const

is power management enabled, allowing screensavers and the system's power management to hide the application

- (int) app: const

Returns the width of the App's current window measured in points.

- (int) app: const

Returns the height of the App's current window measured in points.

- (void) app: (int)  windowWidth
(int)  windowHeight 

Sets the size of the App's current window measured in points. Ignored in full-screen mode.

- (void) app: (const Vec2i &)  size

Sets the size of the App's window measured in points. Ignored in full-screen mode.

- (Vec2f) app: const

Returns the center of the App's window measured in points.

Equivalent to Vec2f( getWindowWidth * 0.5, getWindowHeight * 0.5 )

- (Vec2i) app: const

Returns the size of the App's current window measured in points.

- (float) app: const

Returns the aspect ratio of the App's current window.

- (Area) app: const

Returns the bounding area of the App's current window measured in points.

Equivalent to Area( 0, 0, getWindowWidth, getWindowHeight );

- (float) app: const

Returns the contentScale of the App's window, which is the multiplier that maps points to pixels.

- (Vec2i) app: const

Returns tcoordinates of the top-left corner of the current window measured in points.

- (int) app: const

Returns the X coordinate of the top-left corner of the current window measured in points.

- (int) app: const

Returns the Y coordinate of the top-left corner of the current window contents measured in points.

- (void) app: (int)  x
(int)  y 

Sets the coordinates of the top-left corner of the current window measured in points.

- (virtual void) app: (const Vec2i &)  windowPos

Sets the coordinates of the top-left corner of the current window measured points.

- (virtual float) app: const

Returns the maximum frame-rate the App will attempt to maintain.

- (virtual void) app: (float)  frameRate

Sets the maximum frame-rate the App will attempt to maintain.

- (float) app: const

Returns the average frame-rate attained by the App as measured in frames-per-second.

- (double) app: const

Returns the sampling rate in seconds for measuring the average frame-per-second as returned by getAverageFps

- (void) app: (double)  sampleInterval

Sets the sampling rate in seconds for measuring the average frame-per-second as returned by getAverageFps

- (bool) app: const

Returns whether the App is in full-screen mode or not.

- (void) app: (bool)  aFullScreen
(const FullScreenOptions &)  options = FullScreenOptions() 

Sets whether the active App is in full-screen mode based on fullScreen.

- (double) app: const

Returns the number of seconds which have elapsed since application launch.

- (uint32_t) app: const

Returns the number of animation frames which have elapsed since application launch.

+ (static Vec2i) app:

Returns the current location of the mouse in screen coordinates measured in points. Can be called outside the normal event loop.

+ (static DataSourceRef) app: (const std::string &)  macPath
(int)  mswID
(const std::string &)  mswType 

Returns a DataSourceRef to an application resource. On Mac OS X, macPath is a path relative to the bundle's resources folder. On Windows, mswID and mswType identify the resource as defined the application's .rc file(s). Throws ResourceLoadExc on failure.

See also:
Assets & Resources in Cinder
+ (static DataSourceRef) app: (const std::string &)  macPath

Returns a DataSourceRef to an application resource. macPath is a path relative to the bundle's resources folder. Throws ResourceLoadExc on failure.

See also:
Assets & Resources in Cinder
+ (static path) cinder: (const fs::path &)  rsrcRelativePath

Returns the absolute file path to a resource located at rsrcRelativePath inside the bundle's resources folder. Throws ResourceLoadExc on failure.

See also:
Assets & Resources in Cinder
+ (static path) cinder:

Returns the absolute file path to the bundle's resources folder.

See also:
Assets & Resources in Cinder
+ (static DataSourceRef) app: (int)  mswID
(const std::string &)  mswType 

Returns a DataSourceRef to an application resource. mswID and mswType identify the resource as defined the application's .rc file(s).

See also:
Assets & Resources in Cinder
- (DataSourceRef) app: (const fs::path &)  relativePath

Returns a DataSourceRef to an application asset. Throws a AssetLoadExc on failure.

- fs: (const fs::path &)  relativePath

Returns a fs::path to an application asset. Returns an empty path on failure.

- (void) app: (const fs::path &)  dirPath

Adds an absolute path 'dirPath' to the list of directories which are searched for assets.

- (virtual path) cinder: const

Returns the path to the application on disk.

- (virtual NSBundle*) app: const

Returns the application's bundle (.app) or a screenSaver's bundle (.saver) for AppScreenSaver.

- fs: (const fs::path &)  initialPath = ""
(std::vector< std::string >)  extensions = std::vector< std::string >() 

Presents the user with a file-open dialog and returns the selected file path.

The dialog optionally begins at the path initialPath and can be limited to allow selection of files ending in the extensions enumerated in extensions. If the active app is in full-screen mode it will temporarily switch to windowed-mode to present the dialog.

Returns:
the selected file path or an empty string if the user cancelled.
- fs: (const fs::path &)  initialPath = ""

Presents the user with a folder-open dialog and returns the selected folder.

- fs: (const fs::path &)  initialPath = ""
(std::vector< std::string >)  extensions = std::vector< std::string >() 

Presents the user with a file-save dialog and returns the selected file path.

The dialog optionally begins at the path initialPath and can be limited to allow selection of files ending in the extensions enumerated in extensions. If the active app is in full-screen mode it will temporarily switch to windowed-mode to present the dialog.

Returns:
the selected file path or an empty string if the user cancelled.
- std:

Returns a reference to an output console, which is an alias to std::cout on the mac, and a wrapper around OutputDebugString on MSW.

- (Timeline&) app:

Returns a reference to the App's Timeline.

+ (static bool) app:

Return true if the calling thread is the Application's primary thread.

- boost:

Returns a reference to the App's boost::asio::io_service()

- (void) app: (const std::function< void()> &)  fn

Executes a std::function on the App's primary thread ahead of the next update

template<typename T >
- std: (T)  fn
- (RendererRef) app: const

Returns the default Renderer which will be used when creating a new Window. Set by the app instantiation macro automatically.

- (Surface) app:
Returns:
a copy of the current window's contents as a Surface8u
- (Surface) app: (const Area &)  area
Returns:
a copy of the Area area (measured in pixels) from the current window's contents as a Surface8u
- (void) app:

Restores the current rendering context to be the App's window or the screen in full-screen mode. Generally this is only necessary if the app has displayed a dialog box or some other external window.

- (RendererRef) app: (RendererRef searchRenderer const

Finds any Renderer of the same type as searchRenderer among existing windows. This is generally not necessary and used to enable context sharing between Windows. Returns NULL on failure.

- (virtual bool) app:
- (virtual bool) app: const
+ (static App*) app:

Returns a pointer to the active App.


Friends And Related Function Documentation

- (friend class) AppImplMsw [friend]

Member Data Documentation

- std: [protected]
+ (App*) app: [static, protected]
- (RendererRef) app: [protected]
- (bool) app: [protected]

The documentation for this class was generated from the following file: