- cinder::app::Platform
- cinder::app::PlatformMsw
Public Member Functions
-
PlatformMsw ()
-
loadResource (const fs::path &resourcePath, int mswID, const std::string &mswType) override
-
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 &) 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
Presents the user with an open-file 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 .
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
-
fs::pathgetFolderPath (const fs::path &initialPath) override
Presents the user with an open-folder dialog.
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
-
fs::pathgetSaveFilePath (const fs::path &initialPath, const std::vector< std::string > &extensions) override
Presents the user with a save-file 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 .
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
-
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.
-
std::ostream &console () override
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.
-
voiddirectConsoleToCout (bool shouldDirect)
-
voidlaunchWebBrowser (const Url &url) override
Launches a path in the system's default web browser.
-
voidsleep (float milliseconds) override
Suspends the execution of the current thread until milliseconds have passed. Supports sub-millisecond precision only on OS X.
-
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.
-
voidrefreshDisplays ()
-
findDisplayFromHmonitor (HMONITOR hMonitor)
Returns the Display which corresponds to hMonitor . Returns main display on failure.
-
voidprepareLaunch ()
Called at the beginning of a launch, can be overridden for platform-specifc preparation.
-
voidcleanupLaunch ()
Called at the end of a launch, can be overridden for platform-specifc cleanup.
-
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.
-
loadResource (const fs::path &resourcePath)=0
Returns a DataSource to an application resource. resourcePath is defined on a per-platform basis.
- See Also
CinderResources
-
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.
Static Public Member Functions
-
get ()
-
voidset (Platform *platform)
Sets the current Platform .
Protected Member Functions
-
voidprepareAssetLoading ()
Called when asset directories are first prepared, subclasses can override to add platform specific directories.
-
voidfindAndAddDefaultAssetPath ()
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.