- cinder::app::Platform
- cinder::app::PlatformCocoa
Public Member Functions
-
PlatformCocoa ()
-
voidprepareLaunch () override
Called at the beginning of a launch, can be overridden for platform-specifc preparation.
-
voidcleanupLaunch () override
Called at the end of a launch, can be overridden for platform-specifc cleanup.
-
loadResource (const fs::path &resourcePath) override
Returns a DataSource to an application resource. resourcePath is defined on a per-platform basis.
- See Also
CinderResources
-
fs::pathgetResourceDirectory () const override
Returns the absolute file path to the resources folder. Returns an empty fs::path on windows.
- See Also
CinderResources
-
fs::pathgetResourcePath (const fs::path &rsrcRelativePath) const override
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
-
fs::pathgetOpenFilePath (const fs::path &initialPath, const std::vector< std::string > &extensions) override
Implemented on desktop, no-op on iOS (returns empty path ).
-
fs::pathgetFolderPath (const fs::path &initialPath) override
Implemented on desktop, no-op on iOS (returns empty path ).
-
fs::pathgetSaveFilePath (const fs::path &initialPath, const std::vector< std::string > &extensions) override
Implemented on desktop, no-op on iOS (returns empty path ).
-
voidsetBundle (NSBundle *bundle)
Sets the NSBundle that should be associated with this global platform object. By default this is
[NSBundle mainBundle]
. -
NSBundle *getBundle () const
Returns the NSBundle associated with this global platform object. By default this is
[NSBundle mainBundle]
. -
voidprepareAssetLoading () override
Called when asset directories are first prepared, subclasses can override to add platform specific directories.
-
std::map< std::string, std::string >getEnvironmentVariables () override
Returns a std::map of the system's environment variables. Empty on WinRT.
-
fs::pathexpandPath (const fs::path &path) override
Returns a canonical version of path . Collapses '.', ".." and "//". Converts '~' on Cocoa. Expands environment variables on MSW.
-
fs::pathgetHomeDirectory () const override
Returns the path to the user's home directory.
-
fs::pathgetDocumentsDirectory () const override
Returns the path to the user's documents directory.
-
fs::pathgetDefaultExecutablePath () const override
Returns the path used for the default executable location. Users may override this with setExecutablePath() for application specific purposes.
-
voidsleep (float milliseconds) override
Suspends the execution of the current thread until milliseconds have passed. Supports sub-millisecond precision only on OS X.
-
voidlaunchWebBrowser (const Url &url) override
Launches a path in the system's default web browser.
-
std::vector< std::string >stackTrace () override
Returns a stack trace (aka backtrace) where
stackTrace()
[0] == caller,stackTrace()
[1] == caller's parent, etc. -
voidsetThreadName (const std::string &name) override
Sets the name of the current thread to name .
-
const std::vector< DisplayRef > &getDisplays () override
Returns a std::vector of Displays connected to the system.
-
findDisplayFromUiScreen (UIScreen *uiScreen)
Finds a Display based on its UISScreen. Returns
nullptr
on failure. -
voidaddDisplay (const DisplayRef &display)
Makes a record of display and signals appropriately. Generally only useful for Cinder internals.
-
voidremoveDisplay (const DisplayRef &display)
Removes record of display from mDisplays and signals appropriately. Generally only useful for Cinder internals.
-
loadAsset (const fs::path &relativePath)
Returns a DataSourceRef to an application asset. Throws a AssetLoadExc on failure.
-
fs::pathgetAssetPath (const fs::path &relativePath) const
Returns a fs::path to an application asset. Returns an empty path on failure.
-
voidaddAssetDirectory (const fs::path &directory)
Adds an absolute path to the list of directories which are searched for assets.
Not thread-safe, e.g. you should not call this when loadAsset() or getAssetPath() can occur from a different thread.
-
const std::vector< fs::path > &getAssetDirectories () const
Returns a vector of directories that are searched when looking up an asset path.
-
fs::pathgetExecutablePath () const
Returns the path to the associated executable.
-
voidsetExecutablePath (const fs::path &execPath)
Sets the path to the associated executable, overriding the default.
-
std::ostream &console ()
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.
Static Public Member Functions
-
get ()
-
voidset (Platform *platform)
Sets the current Platform .