Cinder  0.9.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
cinder::app::AppWinRt Class Reference

#include <AppWinRt.h>

Inherits cinder::app::AppBase.

Classes

class  Settings
 

Public Types

typedef std::function< void(Settings *settings)> SettingsFn
 

Public Member Functions

 AppWinRt ()
 
virtual ~AppWinRt ()
 
WindowRef createWindow (const Window::Format &format=Window::Format()) override
 
void quit () override
 
float getFrameRate () const override
 
void setFrameRate (float frameRate) override
 
void disableFrameRate () override
 
bool isFrameRateEnabled () const override
 
WindowRef getWindow () const override
 
WindowRef getWindowIndex (size_t index) const override
 
size_t getNumWindows () const override
 
WindowRef getForegroundWindow () const override
 
void hideCursor () override
 
void showCursor () override
 
ivec2 getMousePos () const override
 
virtual void setup ()
 
virtual void update ()
 
virtual void draw ()
 
virtual void mouseDown (MouseEvent event)
 
virtual void mouseUp (MouseEvent event)
 
virtual void mouseWheel (MouseEvent event)
 
virtual void mouseMove (MouseEvent event)
 
virtual void mouseDrag (MouseEvent event)
 
virtual void touchesBegan (TouchEvent event)
 
virtual void touchesMoved (TouchEvent event)
 
virtual void touchesEnded (TouchEvent event)
 
virtual void keyDown (KeyEvent event)
 
virtual void keyUp (KeyEvent event)
 
virtual void resize ()
 
virtual void fileDrop (FileDropEvent event)
 
virtual void cleanup ()
 
signals::Signal< void()> & getSignalUpdate ()
 
EventSignalShouldQuit & getSignalShouldQuit ()
 
signals::Signal< void()> & getSignalCleanup ()
 
void emitCleanup ()
 
signals::Signal< void()> & getSignalWillResignActive ()
 
void emitWillResignActive ()
 
signals::Signal< void()> & getSignalDidBecomeActive ()
 
void emitDidBecomeActive ()
 
signals::Signal< void(const DisplayRef &display)> & getSignalDisplayConnected ()
 
void emitDisplayConnected (const DisplayRef &display)
 
signals::Signal< void(const DisplayRef &display)> & getSignalDisplayDisconnected ()
 
void emitDisplayDisconnected (const DisplayRef &display)
 
signals::Signal< void(const DisplayRef &display)> & getSignalDisplayChanged ()
 
void emitDisplayChanged (const DisplayRef &display)
 
const std::vector< TouchEvent::Touch > & getActiveTouches () const
 
RendererRef getRenderer () const
 
DisplayRef getDisplay () const
 
virtual void enablePowerManagement (bool powerManagement=true)
 
virtual bool isPowerManagementEnabled () const
 
int getWindowWidth () const
 
int getWindowHeight () const
 
void setWindowSize (int windowWidth, int windowHeight)
 
void setWindowSize (const ivec2 &size)
 
vec2 getWindowCenter () const
 
ivec2 getWindowSize () const
 
float getWindowAspectRatio () const
 
Area getWindowBounds () const
 
float getWindowContentScale () const
 
ivec2 getWindowPos () const
 
int getWindowPosX () const
 
int getWindowPosY () const
 
void setWindowPos (int x, int y)
 
virtual void setWindowPos (const ivec2 &windowPos)
 
float getAverageFps () const
 
double getFpsSampleInterval () const
 
void setFpsSampleInterval (double sampleInterval)
 
virtual bool isFullScreen () const
 
virtual void setFullScreen (bool fullScreen, const FullScreenOptions &options=FullScreenOptions())
 
double getElapsedSeconds () const
 
uint32_t getElapsedFrames () const
 
bool isMultiTouchEnabled () const
 
bool isHighDensityDisplayEnabled () const
 
DataSourceRef loadResource (const fs::path &resourcePath, int mswID, const std::string &mswType) const
 
DataSourceRef loadAsset (const fs::path &relativePath)
 
fs::path getAssetPath (const fs::path &relativePath) const
 
void addAssetDirectory (const fs::path &dirPath)
 
fs::path getAppPath () const
 
fs::path getOpenFilePath (const fs::path &initialPath=fs::path(), const std::vector< std::string > &extensions=std::vector< std::string >())
 
fs::path getFolderPath (const fs::path &initialPath=fs::path())
 
fs::path getSaveFilePath (const fs::path &initialPath=fs::path(), const std::vector< std::string > &extensions=std::vector< std::string >())
 
std::ostream & console ()
 
const std::vector< std::string > & getCommandLineArgs () const
 
Timelinetimeline ()
 
asio::io_service & io_service ()
 
void dispatchAsync (const std::function< void()> &fn)
 
template<typename T >
std::result_of< T()>::type dispatchSync (T fn)
 
RendererRef getDefaultRenderer () const
 
Surface copyWindowSurface ()
 
Surface copyWindowSurface (const Area &area)
 
virtual void restoreWindowContext ()
 
virtual bool receivesEvents () const
 

Static Public Member Functions

static bool isMainThread ()
 
static AppBaseget ()
 

Protected Attributes

bool mPowerManagement
 

Static Protected Attributes

static AppBasesInstance = nullptr
 
static SettingssSettingsFromMain = nullptr
 

Member Typedef Documentation

typedef std::function<void( Settings *settings )> cinder::app::AppWinRt::SettingsFn

Constructor & Destructor Documentation

cinder::app::AppWinRt::AppWinRt ( )
cinder::app::AppWinRt::~AppWinRt ( )
virtual

Member Function Documentation

WindowRef cinder::app::AppWinRt::createWindow ( const Window::Format format = Window::Format())
overridevirtual

Creates and returns a reference to a new Window, adhering to format.

Implements cinder::app::AppBase.

void cinder::app::AppWinRt::quit ( )
overridevirtual

Requests that the application exit gracefully. Use std::terminate() instead to end application immediately.

Implements cinder::app::AppBase.

float cinder::app::AppWinRt::getFrameRate ( ) const
overridevirtual

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

Implements cinder::app::AppBase.

void cinder::app::AppWinRt::setFrameRate ( float  frameRate)
overridevirtual

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

Implements cinder::app::AppBase.

void cinder::app::AppWinRt::disableFrameRate ( )
overridevirtual

Disables frameRate limiting.

Implements cinder::app::AppBase.

bool cinder::app::AppWinRt::isFrameRateEnabled ( ) const
overridevirtual

Returns whether frameRate limiting is enabled.

Implements cinder::app::AppBase.

WindowRef cinder::app::AppWinRt::getWindow ( ) const
overridevirtual

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

Implements cinder::app::AppBase.

WindowRef cinder::app::AppWinRt::getWindowIndex ( size_t  index) const
overridevirtual

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

Implements cinder::app::AppBase.

size_t cinder::app::AppWinRt::getNumWindows ( ) const
overridevirtual

Returns the number of Windows the app has open.

Implements cinder::app::AppBase.

WindowRef cinder::app::AppWinRt::getForegroundWindow ( ) const
overridevirtual

Gets the foreground Window, which has keyboard and mouse focus.

Implements cinder::app::AppBase.

void cinder::app::AppWinRt::hideCursor ( )
overridevirtual

Hides the mouse cursor.

Implements cinder::app::AppBase.

void cinder::app::AppWinRt::showCursor ( )
overridevirtual

Shows the mouse cursor.

Implements cinder::app::AppBase.

ivec2 cinder::app::AppWinRt::getMousePos ( ) const
overridevirtual

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

Implements cinder::app::AppBase.

virtual void cinder::app::AppBase::setup ( )
virtualinherited

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

virtual void cinder::app::AppBase::update ( )
virtualinherited

Override to perform any once-per-loop computation.

virtual void cinder::app::AppBase::draw ( )
virtualinherited

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

virtual void cinder::app::AppBase::mouseDown ( MouseEvent  event)
virtualinherited

Override to receive mouse-down events.

virtual void cinder::app::AppBase::mouseUp ( MouseEvent  event)
virtualinherited

Override to receive mouse-up events.

virtual void cinder::app::AppBase::mouseWheel ( MouseEvent  event)
virtualinherited

Override to receive mouse-wheel events.

virtual void cinder::app::AppBase::mouseMove ( MouseEvent  event)
virtualinherited

Override to receive mouse-move events.

virtual void cinder::app::AppBase::mouseDrag ( MouseEvent  event)
virtualinherited

Override to receive mouse-drag events.

virtual void cinder::app::AppBase::touchesBegan ( TouchEvent  event)
virtualinherited

Override to respond to the beginning of a multitouch sequence.

virtual void cinder::app::AppBase::touchesMoved ( TouchEvent  event)
virtualinherited

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

virtual void cinder::app::AppBase::touchesEnded ( TouchEvent  event)
virtualinherited

Override to respond to the end of a multitouch sequence.

virtual void cinder::app::AppBase::keyDown ( KeyEvent  event)
virtualinherited

Override to receive key-down events.

virtual void cinder::app::AppBase::keyUp ( KeyEvent  event)
virtualinherited

Override to receive key-up events.

virtual void cinder::app::AppBase::resize ( )
virtualinherited

Override to receive window resize events.

virtual void cinder::app::AppBase::fileDrop ( FileDropEvent  event)
virtualinherited

Override to receive file-drop events.

virtual void cinder::app::AppBase::cleanup ( )
virtualinherited

Override to cleanup any resources before app destruction.

signals::Signal<void()>& cinder::app::AppBase::getSignalUpdate ( )
inherited

Emitted at the start of each application update cycle.

EventSignalShouldQuit& cinder::app::AppBase::getSignalShouldQuit ( )
inherited

Signal that emits before the app quit process begins. If any slots return false then the app quitting is canceled.

signals::Signal<void()>& cinder::app::AppBase::getSignalCleanup ( )
inherited

Emitted prior to the application shutting down.

void cinder::app::AppBase::emitCleanup ( )
inherited
signals::Signal<void()>& cinder::app::AppBase::getSignalWillResignActive ( )
inherited
void cinder::app::AppBase::emitWillResignActive ( )
inherited
signals::Signal<void()>& cinder::app::AppBase::getSignalDidBecomeActive ( )
inherited
void cinder::app::AppBase::emitDidBecomeActive ( )
inherited
signals::Signal<void(const DisplayRef &display)>& cinder::app::AppBase::getSignalDisplayConnected ( )
inherited

Emitted when a new display is connected to the system.

void cinder::app::AppBase::emitDisplayConnected ( const DisplayRef display)
inherited

Emits a signal indicating a new display has connected to the system.

signals::Signal<void(const DisplayRef &display)>& cinder::app::AppBase::getSignalDisplayDisconnected ( )
inherited

Emitted when a display is removed from the system.

void cinder::app::AppBase::emitDisplayDisconnected ( const DisplayRef display)
inherited

Emits a signal indicating a display has disconnected from the system.

signals::Signal<void(const DisplayRef &display)>& cinder::app::AppBase::getSignalDisplayChanged ( )
inherited

Emitted when the resolution or some other property of a Display is changed.

void cinder::app::AppBase::emitDisplayChanged ( const DisplayRef display)
inherited

Emits a signal when the resolution or some other property of a Display has changed.

const std::vector<TouchEvent::Touch>& cinder::app::AppBase::getActiveTouches ( ) const
inherited
RendererRef cinder::app::AppBase::getRenderer ( ) const
inherited

Returns the Renderer of the active Window.

DisplayRef cinder::app::AppBase::getDisplay ( ) const
inherited

Returns the Display of the active Window.

virtual void cinder::app::AppBase::enablePowerManagement ( bool  powerManagement = true)
virtualinherited

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

Reimplemented in cinder::app::AppCocoaTouch, and cinder::app::AppMac.

virtual bool cinder::app::AppBase::isPowerManagementEnabled ( ) const
virtualinherited

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

Reimplemented in cinder::app::AppMac.

int cinder::app::AppBase::getWindowWidth ( ) const
inherited

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

int cinder::app::AppBase::getWindowHeight ( ) const
inherited

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

void cinder::app::AppBase::setWindowSize ( int  windowWidth,
int  windowHeight 
)
inherited

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

void cinder::app::AppBase::setWindowSize ( const ivec2 &  size)
inherited

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

vec2 cinder::app::AppBase::getWindowCenter ( ) const
inherited

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

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

ivec2 cinder::app::AppBase::getWindowSize ( ) const
inherited

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

float cinder::app::AppBase::getWindowAspectRatio ( ) const
inherited

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

Area cinder::app::AppBase::getWindowBounds ( ) const
inherited

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

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

float cinder::app::AppBase::getWindowContentScale ( ) const
inherited

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

ivec2 cinder::app::AppBase::getWindowPos ( ) const
inherited

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

int cinder::app::AppBase::getWindowPosX ( ) const
inherited

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

int cinder::app::AppBase::getWindowPosY ( ) const
inherited

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

void cinder::app::AppBase::setWindowPos ( int  x,
int  y 
)
inherited

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

virtual void cinder::app::AppBase::setWindowPos ( const ivec2 &  windowPos)
virtualinherited

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

float cinder::app::AppBase::getAverageFps ( ) const
inherited

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

double cinder::app::AppBase::getFpsSampleInterval ( ) const
inherited

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

void cinder::app::AppBase::setFpsSampleInterval ( double  sampleInterval)
inherited

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

virtual bool cinder::app::AppBase::isFullScreen ( ) const
virtualinherited

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

Reimplemented in cinder::app::AppCocoaTouch.

virtual void cinder::app::AppBase::setFullScreen ( bool  fullScreen,
const FullScreenOptions options = FullScreenOptions() 
)
virtualinherited

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

Reimplemented in cinder::app::AppCocoaTouch.

double cinder::app::AppBase::getElapsedSeconds ( ) const
inherited

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

uint32_t cinder::app::AppBase::getElapsedFrames ( ) const
inherited

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

bool cinder::app::AppBase::isMultiTouchEnabled ( ) const
inherited

Returns whether the app is registered to receive multiTouch events from the operating system, configurable via Settings at startup. Disabled by default on desktop platforms, enabled on mobile.

bool cinder::app::AppBase::isHighDensityDisplayEnabled ( ) const
inherited

Returns whether Windows created on a high-density (Retina) display will have their resolution doubled, configurable via Settings at startup. Default is true on iOS and false on other platforms.

DataSourceRef cinder::app::AppBase::loadResource ( const fs::path &  resourcePath,
int  mswID,
const std::string &  mswType 
) const
inherited

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

See also
CinderResources
DataSourceRef cinder::app::AppBase::loadAsset ( const fs::path &  relativePath)
inherited

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

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

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

void cinder::app::AppBase::addAssetDirectory ( const fs::path &  dirPath)
inherited

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

fs::path cinder::app::AppBase::getAppPath ( ) const
inherited

Returns the path to the application on disk.

fs::path cinder::app::AppBase::getOpenFilePath ( const fs::path &  initialPath = fs::path(),
const std::vector< std::string > &  extensions = std::vector<std::string>() 
)
inherited

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.

Returns
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
fs::path cinder::app::AppBase::getFolderPath ( const fs::path &  initialPath = fs::path())
inherited

Presents the user with an open-folder dialog.

Returns
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
fs::path cinder::app::AppBase::getSaveFilePath ( const fs::path &  initialPath = fs::path(),
const std::vector< std::string > &  extensions = std::vector<std::string>() 
)
inherited

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.

Returns
the selected file path, or an empty fs::path if the user cancelled or this operation isn't supported on the current platform.
std::ostream & cinder::app::AppBase::console ( )
inherited

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.

const std::vector<std::string>& cinder::app::AppBase::getCommandLineArgs ( ) const
inherited

Returns a vector of the command line arguments passed to the app when intantiated.

Timeline& cinder::app::AppBase::timeline ( )
inherited

Returns a reference to the App's Timeline.

bool cinder::app::AppBase::isMainThread ( )
staticinherited

Returns true if the calling thread is the Application's main thread (the thread running the main function), false otherwise.

asio::io_service& cinder::app::AppBase::io_service ( )
inherited

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

void cinder::app::AppBase::dispatchAsync ( const std::function< void()> &  fn)
inherited

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

template<typename T >
std::result_of< T()>::type cinder::app::AppBase::dispatchSync ( fn)
inherited
RendererRef cinder::app::AppBase::getDefaultRenderer ( ) const
inherited

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

Surface cinder::app::AppBase::copyWindowSurface ( )
inherited
Returns
a copy of the current window's contents as a Surface8u
Surface cinder::app::AppBase::copyWindowSurface ( const Area area)
inherited
Returns
a copy of the Area area (measured in pixels) from the current window's contents as a Surface8u
void cinder::app::AppBase::restoreWindowContext ( )
virtualinherited

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.

virtual bool cinder::app::AppBase::receivesEvents ( ) const
virtualinherited

Reimplemented in cinder::app::AppScreenSaver.

static AppBase* cinder::app::AppBase::get ( )
staticinherited

Returns a pointer to the active App.

Member Data Documentation

AppBase * cinder::app::AppBase::sInstance = nullptr
staticprotectedinherited
AppBase::Settings * cinder::app::AppBase::sSettingsFromMain = nullptr
staticprotectedinherited
bool cinder::app::AppBase::mPowerManagement
protectedinherited

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