Cinder  0.9.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cinder::app::PlatformCocoa Class Referenceabstract

#include <PlatformCocoa.h>

Inherits cinder::app::Platform.

Public Member Functions

 PlatformCocoa ()
 
void prepareLaunch () override
 
void cleanupLaunch () override
 
DataSourceRef loadResource (const fs::path &resourcePath) override
 
fs::path getResourceDirectory () const override
 
fs::path getResourcePath (const fs::path &rsrcRelativePath) const override
 
fs::path getOpenFilePath (const fs::path &initialPath, const std::vector< std::string > &extensions) override
 
fs::path getFolderPath (const fs::path &initialPath) override
 
fs::path getSaveFilePath (const fs::path &initialPath, const std::vector< std::string > &extensions) override
 
void setBundle (NSBundle *bundle)
 
NSBundle * getBundle () const
 
void prepareAssetLoading () override
 
std::map< std::string, std::string > getEnvironmentVariables () override
 
fs::path expandPath (const fs::path &path) override
 
fs::path getHomeDirectory () const override
 
fs::path getDocumentsDirectory () const override
 
fs::path getDefaultExecutablePath () const override
 
void sleep (float milliseconds) override
 
void launchWebBrowser (const Url &url) override
 
std::vector< std::string > stackTrace () override
 
const std::vector< DisplayRef > & getDisplays () override
 
DisplayRef findDisplayFromUiScreen (UIScreen *uiScreen)
 
void addDisplay (const DisplayRef &display)
 
void removeDisplay (const DisplayRef &display)
 
DataSourceRef loadAsset (const fs::path &relativePath)
 
fs::path getAssetPath (const fs::path &relativePath) const
 
void addAssetDirectory (const fs::path &directory)
 
const std::vector< fs::path > & getAssetDirectories () const
 
virtual DataSourceRef loadResource (const fs::path &resourcePath, int mswID, const std::string &mswType)=0
 
fs::path getExecutablePath () const
 
void setExecutablePath (const fs::path &execPath)
 
virtual std::ostream & console ()
 

Static Public Member Functions

static PlatformCocoaget ()
 
static void set (Platform *platform)
 

Protected Member Functions

virtual void findAndAddDefaultAssetPath ()
 

Constructor & Destructor Documentation

cinder::app::PlatformCocoa::PlatformCocoa ( )

Member Function Documentation

static PlatformCocoa* cinder::app::PlatformCocoa::get ( )
static
void cinder::app::PlatformCocoa::prepareLaunch ( )
overridevirtual

Called at the beginning of a launch, can be overridden for platform-specifc preparation.

Reimplemented from cinder::app::Platform.

void cinder::app::PlatformCocoa::cleanupLaunch ( )
overridevirtual

Called at the end of a launch, can be overridden for platform-specifc cleanup.

Reimplemented from cinder::app::Platform.

DataSourceRef cinder::app::PlatformCocoa::loadResource ( const fs::path &  resourcePath)
override
fs::path cinder::app::PlatformCocoa::getResourceDirectory ( ) const
overridevirtual

Returns the absolute file path to the resources folder. Returns an empty fs::path on windows.

See also
CinderResources

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::getResourcePath ( const fs::path &  rsrcRelativePath) const
overridevirtual

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

See also
CinderResources

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::getOpenFilePath ( const fs::path &  initialPath,
const std::vector< std::string > &  extensions 
)
overridevirtual

Implemented on desktop, no-op on iOS (returns empty path ).

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::getFolderPath ( const fs::path &  initialPath)
overridevirtual

Implemented on desktop, no-op on iOS (returns empty path ).

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::getSaveFilePath ( const fs::path &  initialPath,
const std::vector< std::string > &  extensions 
)
overridevirtual

Implemented on desktop, no-op on iOS (returns empty path ).

Implements cinder::app::Platform.

void cinder::app::PlatformCocoa::setBundle ( NSBundle *  bundle)

Sets the NSBundle that should be associated with this global platform object. By default this is [NSBundle mainBundle].

NSBundle * cinder::app::PlatformCocoa::getBundle ( ) const

Returns the NSBundle associated with this global platform object. By default this is [NSBundle mainBundle].

void cinder::app::PlatformCocoa::prepareAssetLoading ( )
overridevirtual

Called when asset directories are first prepared, subclasses can override to add platform specific directories.

Reimplemented from cinder::app::Platform.

map< string, string > cinder::app::PlatformCocoa::getEnvironmentVariables ( )
overridevirtual

Returns a std::map of the system's environment variables. Empty on WinRT.

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::expandPath ( const fs::path &  path)
overridevirtual

Returns a canonical version of path. Collapses '.', ".." and "//". Converts '~' on Cocoa. Expands environment variables on MSW.

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::getHomeDirectory ( ) const
overridevirtual

Returns the path to the user's home directory.

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::getDocumentsDirectory ( ) const
overridevirtual

Returns the path to the user's documents directory.

Implements cinder::app::Platform.

fs::path cinder::app::PlatformCocoa::getDefaultExecutablePath ( ) const
overridevirtual

Returns the path used for the default executable location. Users may override this with setExecutablePath() for application specific purposes.

Implements cinder::app::Platform.

void cinder::app::PlatformCocoa::sleep ( float  milliseconds)
overridevirtual

Suspends the execution of the current thread until milliseconds have passed. Supports sub-millisecond precision only on OS X.

Implements cinder::app::Platform.

void cinder::app::PlatformCocoa::launchWebBrowser ( const Url url)
overridevirtual

Launches a path in the system's default web browser.

Implements cinder::app::Platform.

vector< string > cinder::app::PlatformCocoa::stackTrace ( )
overridevirtual

Returns a stack trace (aka backtrace) where stackTrace()[0] == caller, stackTrace()[1] == caller's parent, etc.

Implements cinder::app::Platform.

const std::vector< DisplayRef > & cinder::app::PlatformCocoa::getDisplays ( )
overridevirtual

Returns a std::vector of Displays connected to the system.

Implements cinder::app::Platform.

DisplayRef cinder::app::PlatformCocoa::findDisplayFromUiScreen ( UIScreen *  uiScreen)

Finds a Display based on its UISScreen. Returns nullptr on failure.

void cinder::app::PlatformCocoa::addDisplay ( const DisplayRef display)

Makes a record of display and signals appropriately. Generally only useful for Cinder internals.

void cinder::app::PlatformCocoa::removeDisplay ( const DisplayRef display)

Removes record of display from mDisplays and signals appropriately. Generally only useful for Cinder internals.

void cinder::app::Platform::set ( Platform platform)
staticinherited

Sets the current Platform.

DataSourceRef cinder::app::Platform::loadAsset ( const fs::path &  relativePath)
inherited

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

fs::path cinder::app::Platform::getAssetPath ( const fs::path &  relativePath) const
inherited

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

void cinder::app::Platform::addAssetDirectory ( const fs::path &  directory)
inherited

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

Note
Not thread-safe, e.g. you should not call this when loadAsset() or getAssetPath() can occur from a different thread.
const vector< fs::path > & cinder::app::Platform::getAssetDirectories ( ) const
inherited

Returns a vector of directories that are searched when looking up an asset path.

virtual DataSourceRef cinder::app::Platform::loadResource ( const fs::path &  resourcePath,
int  mswID,
const std::string &  mswType 
)
pure virtualinherited

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

See also
CinderResources

Implemented in cinder::app::PlatformMsw.

fs::path cinder::app::Platform::getExecutablePath ( ) const
inherited

Returns the path to the associated executable.

void cinder::app::Platform::setExecutablePath ( const fs::path &  execPath)
inherited

Sets the path to the associated executable, overriding the default.

std::ostream & cinder::app::Platform::console ( )
virtualinherited

Returns a reference to an output console, which is by default an alias to std::cout. Other platforms may override to use other necessary console mechanisms.

Reimplemented in cinder::app::PlatformWinRt, and cinder::app::PlatformMsw.

void cinder::app::Platform::findAndAddDefaultAssetPath ( )
protectedvirtualinherited

Called to add the default assets folder by walking up the path from the executable until a folder named 'assets' is found. Subclasses can override this method to disable this functionality.


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