- cinder::app::AppBase
- cinder::app::AppCocoaTouch
Enums
Public Member Functions
-
AppCocoaTouch ()
-
~AppCocoaTouch ()
-
signals::Signal< void()> &getSignalDidEnterBackground ()
-
voidemitDidEnterBackground ()
-
signals::Signal< void()> &getSignalWillEnterForeground ()
-
voidemitWillEnterForeground ()
-
signals::Signal< void()> &getSignalMemoryWarning ()
-
voidemitMemoryWarning ()
-
EventSignalSupportedOrientations &getSignalSupportedOrientations ()
Returns the signal emitted when an orientation change may occur, allowing the user to specify which orientations are permitted (any connection can forbid a given orientation). The connected std::function must return an InterfaceOrientation bitmask.
-
uint32_temitSupportedOrientations ()
Emits a signal to ask the user what orientations are supported.
-
signals::Signal< void()> &getSignalWillRotate ()
Returns the signal emitted when the interface is about to rotate to a new orientation. At this time, the Window 's bounds and orientation have already been updated.
-
voidemitWillRotate ()
Emits the signal to notify the user that the orientation will change.
-
signals::Signal< void()> &getSignalDidRotate ()
Returns the signal emitted when the interface is finished rotating to a new orientation.
-
voidemitDidRotate ()
Emits the signal to notify the user that the orientation did change.
-
signals::Signal< void()> &getSignalKeyboardWillShow ()
Returns the signal emitted when the virtual keyboard is about to animate on screen.
-
voidemitKeyboardWillShow ()
Emits the signal used to notify when the virtual keyboard is about to animate on screen.
-
signals::Signal< void()> &getSignalKeyboardWillHide ()
Returns the signal emitted when the virtual keyboard is about to animate off screen.
-
voidemitKeyboardWillHide ()
Emits the signal used to notify when the virtual keyboard is about to animate off screen.
-
createWindow (const Window::Format &format=Window::Format()) override
Creates and returns a reference to a new Window , adhering to format .
-
getWindow () const override
Returns the the currently active Window . Throws ExcInvalidWindow if called with no active window.
-
getForegroundWindow () const override
Gets the foreground Window , which has keyboard and mouse focus.
-
size_tgetNumWindows () const override
Returns the number of Windows the app has open.
-
getWindowIndex (size_t index=0) const override
Gets a Window by index, in the range [0, getNumWindows() ). Throw ExcInvalidWindow if index is out of bounds.
-
InterfaceOrientationgetOrientation () const
Returns the InterfaceOrientation for the device Window .
-
InterfaceOrientationgetWindowOrientation () const
Returns the current InterfaceOrientation for the active Window .
-
voidhideCursor () override
no-op, no cursor on this platform
-
voidshowCursor () override
no-op, no cursor on this platform
-
voiddisableFrameRate () override
no-op, cannot disable framerate on this platform
-
boolisFrameRateEnabled () const override
always false, cannot disable framerate on this platform
-
voidenableProximitySensor ()
Enables the device's proximity sensor, which can return whether the device is close to the user or not. Use in conjunction with proximityIsClose() or getSignalProximitySensor()
-
voiddisableProximitySensor ()
Disables the device's proximity sensor.
-
boolproximityIsClose () const
Returns whether the device is close to the user or not. Must call enableProximitySensor() before using.
-
signals::Signal< void(bool)> &getSignalProximitySensor ()
Signal emitted when the device becomes close (
true
) or far (false
). Must call enableProximitySensor() before using. -
voidemitSignalProximitySensor (bool isClose)
-
voidenableBatteryMonitoring ()
Enables the device's battery monitor. Use in conjunction with getBatteryLevel() , isUnplugged() and getSignalBatteryState()
-
voiddisableBatteryMonitoring ()
Disables the device's battery monitor.
-
floatgetBatteryLevel () const
Returns the device's battery level, in the range of [0,1];.
-
boolisUnplugged () const
Returns
true
when the device is not plugged into power. -
signals::Signal< void(bool)> &getSignalBatteryState ()
Signal emitted when the device is unplugged (
true
) or plugged in (false
). Use in place of polling isUnplugged() . -
voidemitSignalBatteryState (bool isUnplugged)
-
voidenablePowerManagement (bool powerManagement=true) override
When disabled, the device will not sleep even after the idling threshold.
-
voidshowKeyboard (const KeyboardOptions &options=KeyboardOptions())
Shows the iOS virtual keyboard with KeyboardOptions options . This method can be called with new options while the keyboard is visible.
-
boolisKeyboardVisible () const
Returns whether the iOS keyboard is visible.
-
voidhideKeyboard ()
Hides the default iOS keyboard.
-
std::stringgetKeyboardString () const
Returns the current text recorded since the most recent call to showKeyboard() .
-
voidsetKeyboardString (const std::string &keyboardString)
Sets the current text string that the keyboard is manipulating, overwriting any previous content.
-
::UITextView *getKeyboardTextView () const
Retuens a pointer to the native UITextView, which can be used to customize the virtual keyboard.
-
voidshowStatusBar (StatusBarAnimation animation=StatusBarAnimation::NONE)
Shows the system status bar.
-
boolisStatusBarVisible () const
Returns whether the system status bar is visible.
-
voidhideStatusBar (StatusBarAnimation animation=StatusBarAnimation::NONE)
Hides the system status bar.
-
floatgetFrameRate () const override
Returns the maximum frame-rate the App will attempt to maintain.
-
voidsetFrameRate (float frameRate) override
Sets the maximum frame-rate the App will attempt to maintain.
-
boolisFullScreen () const override
Overidden to always return true on mobile.
-
voidsetFullScreen (bool fullScreen, const FullScreenOptions &options=FullScreenOptions()) override
Overidden to disable, mobile is always full screen.
-
ivec2getMousePos () const override
Returns an invalid position since the device doesn't have a mouse.
-
voidquit () override
No-op on iOS.
-
voidsetup ()
Override to perform any application setup after the Renderer has been initialized.
-
voidupdate ()
Override to perform any once-per-loop computation.
-
voiddraw ()
Override to perform any rendering once-per-loop or in response to OS-prompted requests for refreshes.
-
voidmouseDown (MouseEvent event)
Override to receive mouse-down events.
-
voidmouseUp (MouseEvent event)
Override to receive mouse-up events.
-
voidmouseWheel (MouseEvent event)
Override to receive mouse-wheel events.
-
voidmouseMove (MouseEvent event)
Override to receive mouse-move events.
-
voidmouseDrag (MouseEvent event)
Override to receive mouse-drag events.
-
voidtouchesBegan (TouchEvent event)
Override to respond to the beginning of a multitouch sequence.
-
voidtouchesMoved (TouchEvent event)
Override to respond to movement (drags) during a multitouch sequence.
-
voidtouchesEnded (TouchEvent event)
Override to respond to the end of a multitouch sequence.
-
voidkeyDown (KeyEvent event)
Override to receive key-down events.
-
voidkeyUp (KeyEvent event)
Override to receive key-up events.
-
voidresize ()
Override to receive window resize events.
-
voidfileDrop (FileDropEvent event)
Override to receive file-drop events.
-
voidcleanup ()
Override to cleanup any resources before app destruction.
-
signals::Signal< void()> &getSignalUpdate ()
Emitted at the start of each application update cycle.
-
EventSignalShouldQuit &getSignalShouldQuit ()
Signal that emits before the app quit process begins. If any slots return false then the app quitting is canceled.
-
signals::Signal< void()> &getSignalCleanup ()
Emitted prior to the application shutting down.
-
voidemitCleanup ()
-
signals::Signal< void()> &getSignalWillResignActive ()
-
voidemitWillResignActive ()
-
signals::Signal< void()> &getSignalDidBecomeActive ()
-
voidemitDidBecomeActive ()
-
signals::Signal< void(const DisplayRef &display)> &getSignalDisplayConnected ()
Emitted when a new display is connected to the system.
-
voidemitDisplayConnected (const DisplayRef &display)
Emits a signal indicating a new display has connected to the system.
-
signals::Signal< void(const DisplayRef &display)> &getSignalDisplayDisconnected ()
Emitted when a display is removed from the system.
-
voidemitDisplayDisconnected (const DisplayRef &display)
Emits a signal indicating a display has disconnected from the system.
-
signals::Signal< void(const DisplayRef &display)> &getSignalDisplayChanged ()
Emitted when the resolution or some other property of a Display is changed.
-
voidemitDisplayChanged (const DisplayRef &display)
Emits a signal when the resolution or some other property of a Display has changed.
-
const std::vector< TouchEvent::Touch > &getActiveTouches () const
-
boolisPowerManagementEnabled () const
is power management enabled, allowing screensavers and the system's power management to hide the application
-
intgetWindowWidth () const
Returns the width of the App's current window measured in points.
-
intgetWindowHeight () const
Returns the height of the App's current window measured in points.
-
voidsetWindowSize (int windowWidth, int windowHeight)
Sets the size of the App's current window measured in points. Ignored in full-screen mode.
-
voidsetWindowSize (const ivec2 &size)
Sets the size of the App's window measured in points. Ignored in full-screen mode.
-
vec2getWindowCenter () const
Returns the center of the App's window measured in points.
Equivalent to
vec2( getWindowWidth() * 0.5, getWindowHeight() * 0.5 )
-
ivec2getWindowSize () const
Returns the size of the App's current window measured in points.
-
floatgetWindowAspectRatio () const
Returns the aspect ratio of the App's current window.
-
getWindowBounds () const
Returns the bounding area of the App's current window measured in points.
Equivalent to
Area ( 0, 0, getWindowWidth() , getWindowHeight() );
-
floatgetWindowContentScale () const
Returns the contentScale of the App's window, which is the multiplier that maps points to pixels.
-
ivec2getWindowPos () const
Returns tcoordinates of the top-left corner of the current window measured in points.
-
intgetWindowPosX () const
Returns the X coordinate of the top-left corner of the current window measured in points.
-
intgetWindowPosY () const
Returns the Y coordinate of the top-left corner of the current window contents measured in points.
-
voidsetWindowPos (int x, int y)
Sets the coordinates of the top-left corner of the current window measured in points.
-
voidsetWindowPos (const ivec2 &windowPos)
Sets the coordinates of the top-left corner of the current window measured points.
-
floatgetAverageFps () const
Returns the average frame-rate attained by the App as measured in frames-per-second.
-
doublegetFpsSampleInterval () const
Returns the sampling rate in seconds for measuring the average frame-per-second as returned by getAverageFps()
-
voidsetFpsSampleInterval (double sampleInterval)
Sets the sampling rate in seconds for measuring the average frame-per-second as returned by getAverageFps()
-
doublegetElapsedSeconds () const
Returns the number of seconds which have elapsed since application launch.
-
uint32_tgetElapsedFrames () const
Returns the number of animation frames which have elapsed since application launch.
-
boolisMultiTouchEnabled () const
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
-
loadResource (const fs::path &resourcePath) const
-
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 &dirPath)
Adds an absolute path 'dirPath' to the list of directories which are searched for assets.
-
fs::pathgetAppPath () const
Returns the path to the application on disk.
-
fs::pathgetOpenFilePath (const fs::path &initialPath=fs::path(), const std::vector< std::string > &extensions=std::vector< std::string >())
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=fs::path())
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=fs::path(), const std::vector< std::string > &extensions=std::vector< std::string >())
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::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.
-
const std::vector< std::string > &getCommandLineArgs () const
Returns a vector of the command line arguments passed to the app when intantiated.
-
Timeline &timeline ()
Returns a reference to the App's Timeline .
-
asio::io_context &io_context ()
Returns a reference to the App's boost::asio::io_service()
-
voiddispatchAsync (const std::function< void()> &fn)
Executes a std::function on the App's primary thread ahead of the next update()
-
decltype(std::declval< T >()())dispatchSync (T fn)
-
copyWindowSurface ()
a copy of the current window's contents as a Surface8u
-
copyWindowSurface (const Area &area)
a copy of the Area area (measured in pixels) from the current window's contents as a Surface8u
-
voidrestoreWindowContext ()
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.
-
boolreceivesEvents () const
Static Public Member Functions
-
get ()
Returns a pointer to the current global AppCocoaTouch .
-
boolisMainThread ()
Returns
true
if the calling thread is the Application's main thread (the thread running the main function), false otherwise.
Protected Member Functions
Protected Attributes
-
Settings *sSettingsFromMain
-
boolmPowerManagement