Classes | Typedefs | Enumerations | Functions | Variables
cinder::app Namespace Reference

Classes

struct  BooleanOrEventCombiner
 Returns true if any slots return true, else false. Does not short-circuit. Returns true if there are no slots. More...
struct  BooleanAndEventCombiner
 Returns true if all slots return true, else false. Does not short-circuit. Returns true if there are no slots. More...
struct  BitwiseAndEventCombiner
 Returns a bitmask where in order for the bit in type T to be be 1, it has to be 1 from all slot. Returns 0 if there are no slots. More...
class  App
class  AppImplMsw
class  WindowImplMsw
class  BlankingWindow
class  AppImplMswBasic
class  WindowImplMswBasic
class  AppImplMswRenderer
class  AppImplMswRendererGdi
class  AppImplMswRendererGl
class  AppImplMswScreenSaver
class  WindowImplMswScreenSaver
struct  EventCombiner
class  Event
 Base class for all Events. More...
class  FileDropEvent
 Represents a file-drop event, typically received from Windows Explorer or Mac OS X Finder. More...
class  KeyEvent
 Represents a keyboard event. More...
class  MouseEvent
 Represents a mouse event. More...
class  Renderer
class  TouchEvent
 Represents a touch event. More...

Typedefs

typedef std::shared_ptr< class
BlankingWindow
BlankingWindowRef
typedef AppBasic AppNative
typedef std::shared_ptr< Window > WindowRef
typedef std::shared_ptr< class
Renderer
RendererRef
typedef std::shared_ptr< class
RendererGl > 
RendererGlRef

Enumerations

enum  InterfaceOrientation {
  Unknown = 0, Portrait = 1 << 0, PortraitUpsideDown = 1 << 1, LandscapeLeft = 1 << 2,
  LandscapeRight = 1 << 3, PortraitAll = (Portrait | PortraitUpsideDown), LandscapeAll = (LandscapeLeft | LandscapeRight), All = (PortraitAll | LandscapeAll)
}

Functions

std::ostream & operator<< (std::ostream &lhs, const InterfaceOrientation &rhs)
float getOrientationDegrees (InterfaceOrientation orientation)
LRESULT CALLBACK WndProc (HWND mWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT CALLBACK BlankingWndProc (HWND mWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
unsigned int prepMouseEventModifiers (WPARAM wParam)
int prepNativeKeyCode (WPARAM wParam)
WCHAR mapVirtualKey (WPARAM wParam)
unsigned int prepKeyEventModifiers ()
HWND createDummyWindow (int *width, int *height, bool fullscreen)
std::ostream & operator<< (std::ostream &out, const FileDropEvent &event)
std::ostream & operator<< (std::ostream &out, const TouchEvent::Touch &touch)
std::ostream & operator<< (std::ostream &out, const TouchEvent &event)
App Free Functions

Convenience methods which mirror App member-functions and apply to the active application

WindowRef getWindow ()
 Returns the number of Windows the app has open.
size_t getNumWindows ()
 Returns the number of Windows the app has open.
WindowRef getWindowIndex (size_t index)
 Gets a Window by index, in the range [0, getNumWindows()).
int getWindowWidth ()
 Returns the width of the active App's window measured in points, or of the screen when in full-screen mode.
void setWindowPos (const Vec2i &windowPos)
 Sets the position of the active App's window measured in points. Ignored in full-screen mode.
void setWindowPos (int x, int y)
 Sets the position of the active App's window measured in points. Ignored in full-screen mode.
int getWindowHeight ()
 Returns the height of the active App's window measured in points, or the screen when in full-screen mode.
void setWindowSize (int windowWidth, int windowHeight)
 Sets the size of the active App's window in points. Ignored in full-screen mode.
Vec2f getWindowCenter ()
 Returns the center of the active App's window in pixels or of the screen in full-screen mode.
Vec2i getWindowSize ()
 Returns the size of the active App's window or the screen in full-screen mode measured in points.
Vec2i getWindowPos ()
 Returns the position of the active App's window measured in points.
float getWindowAspectRatio ()
 Returns the aspect ratio of the active App's window or the screen in full-screen mode.
Area getWindowBounds ()
 Returns the bounding area of the active App's window or the screen in full-screen mode measured in points.
float getWindowContentScale ()
 Returns the contentScale of the active App's window, which is the multiplier that maps points to pixels.
float getFrameRate ()
 Returns the maximum frame-rate the active App will attempt to maintain.
void setFrameRate (float frameRate)
 Sets the maximum frame-rate the active App will attempt to maintain.
bool isFullScreen ()
 Returns whether the active App is in full-screen mode or not.
void setFullScreen (bool fullScreen=true)
 Sets whether the active App is in full-screen mode based on fullScreen.
float toPixels (float s)
 Returns a scalar mapped from points to pixels for the current Window.
Vec2f toPixels (Vec2f s)
 Returns a Vec2f mapped from points to pixels for the current Window.
Area toPixels (const Area &a)
 Returns an Area mapped from points to pixels for the current Window.
Rectf toPixels (const Rectf &a)
 Returns a Rectf mapped from points to pixels for the current Window.
float toPoints (float s)
 Returns a scalar mapped from pixels to points for the current Window.
Vec2f toPoints (Vec2f s)
 Returns a Vec2f mapped from pixels to points for the current Window.
Area toPoints (const Area &a)
 Returns an Area mapped from pixels to points for the current Window.
Rectf toPoints (const Rectf &a)
 Returns a Rectf mapped from pixels to points for the current Window.
double getElapsedSeconds ()
 Returns the number seconds which have elapsed since the active App launched.
uint32_t getElapsedFrames ()
 Returns the number of animation frames which have elapsed since the active App launched.
DataSourceRef loadResource (const std::string &macPath, int mswID, const std::string &mswType)
 Returns a DataSource to an application resource. On Mac OS X, macPath is a path relative to the bundle's resources folder. On Windows, mswID and mswType identify the resource as defined the application's .rc file(s).
DataSourceRef loadResource (const std::string &macPath)
 Returns a DataSource to an application resource. macPath is a path relative to the bundle's resources folder.
DataSourceRef loadResource (int mswID, const std::string &mswType)
 Returns a DataSource to an application resource. mswID and mswType identify the resource as defined the application's .rc file(s).
DataSourceRef loadAsset (const fs::path &relativePath)
 Returns a DataSourceRef to the active App's's asset. Throws a AssetLoadExc on failure.
fs::path getAssetPath (const fs::path &relativePath)
 Returns a fs::path to the active App's asset. Returns an empty path on failure.
void addAssetDirectory (const fs::path &dirPath)
 Adds an absolute path dirPath to the active App's list of directories which are searched for assets.
fs::path getAppPath ()
 Returns the path to the active App on disk.
fs::path getOpenFilePath (const fs::path &initialPath="", std::vector< std::string > extensions=std::vector< std::string >())
 Presents the user with a file-open dialog and returns the selected file path.
fs::path getSaveFilePath (const fs::path &initialPath="", std::vector< std::string > extensions=std::vector< std::string >())
 Presents the user with a file-save dialog and returns the selected file path.
std::ostream & console ()
 Returns a reference to an output console, which is an alias to std::cout on the mac, and a wrapper around OutputDebugString on MSW.
Timelinetimeline ()
 Returns a reference to the active App's Timeline.
Surface copyWindowSurface ()
 Returns a copy of the current window's contents as a Surface8u.
Surface copyWindowSurface (const Area &area)
 Returns a copy of the Area area from the current window's contents as a Surface8u.
void restoreWindowContext ()
 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 display a dialog box or some other external window.
inline::CGContextRef createWindowCgContext ()
 Returns a CGContextRef for drawing to the Window using CoreGraphics under Cocoa & Cocoa Touch. Assumes your App uses a Renderer2d.

Variables

bool sMultisampleSupported = false
int sArbMultisampleFormat
map< int, int > sKeyTable
 __pad0__
 Signal used for retrieving the supported orientations. BitwiseAndEventCombiner is used so that any connection can forbid a certain orientation.
BooleanAndEventCombiner EventSignalShouldQuit
BitwiseAndEventCombiner< uint32_t > EventSignalSupportedOrientations
EventCombiner< MouseEventEventSignalMouse
 __pad1__
EventCombiner< TouchEventEventSignalTouch
 __pad2__
EventCombiner< KeyEventEventSignalKey
 __pad3__
EventCombiner< FileDropEventEventSignalFileDrop
 __pad4__

Typedef Documentation

typedef std::shared_ptr<class BlankingWindow> cinder::app::BlankingWindowRef
typedef AppBasic cinder::app::AppNative
typedef std::shared_ptr< Window > cinder::app::WindowRef
typedef std::shared_ptr<class Renderer> cinder::app::RendererRef
typedef std::shared_ptr<class RendererGl> cinder::app::RendererGlRef

Enumeration Type Documentation

Enumerator:
Unknown 
Portrait 
PortraitUpsideDown 
LandscapeLeft 
LandscapeRight 
PortraitAll 
LandscapeAll 
All 

Function Documentation

std::ostream& cinder::app::operator<< ( std::ostream &  lhs,
const InterfaceOrientation &  rhs 
)
float cinder::app::getOrientationDegrees ( InterfaceOrientation  orientation)
LRESULT CALLBACK cinder::app::WndProc ( HWND  mWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
LRESULT CALLBACK cinder::app::BlankingWndProc ( HWND  mWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
unsigned int cinder::app::prepMouseEventModifiers ( WPARAM  wParam)
int cinder::app::prepNativeKeyCode ( WPARAM  wParam)
WCHAR cinder::app::mapVirtualKey ( WPARAM  wParam)
HWND cinder::app::createDummyWindow ( int *  width,
int *  height,
bool  fullscreen 
)

Returns the number of Windows the app has open.

Returns the number of Windows the app has open.

Gets a Window by index, in the range [0, getNumWindows()).

Returns the width of the active App's window measured in points, or of the screen when in full-screen mode.

void cinder::app::setWindowPos ( const Vec2i &  windowPos)

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

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

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

Returns the height of the active App's window measured in points, or the screen when in full-screen mode.

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

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

Returns the center of the active App's window in pixels or of the screen in full-screen mode.

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

Returns the size of the active App's window or the screen in full-screen mode measured in points.

Returns the position of the active App's window measured in points.

Returns the aspect ratio of the active App's window or the screen in full-screen mode.

Returns the bounding area of the active App's window or the screen in full-screen mode measured in points.

Equivalent to

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

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

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

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

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

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

void cinder::app::setFullScreen ( bool  fullScreen = true)

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

float cinder::app::toPixels ( float  s)

Returns a scalar mapped from points to pixels for the current Window.

Returns a Vec2f mapped from points to pixels for the current Window.

Returns a Vec2i mapped from points to pixels for the current Window.

Area cinder::app::toPixels ( const Area &  a)

Returns an Area mapped from points to pixels for the current Window.

Rectf cinder::app::toPixels ( const Rectf &  a)

Returns a Rectf mapped from points to pixels for the current Window.

float cinder::app::toPoints ( float  s)

Returns a scalar mapped from pixels to points for the current Window.

Returns a Vec2f mapped from pixels to points for the current Window.

Returns a Vec2i mapped from pixels to points for the current Window.

Area cinder::app::toPoints ( const Area &  a)

Returns an Area mapped from pixels to points for the current Window.

Rectf cinder::app::toPoints ( const Rectf &  a)

Returns a Rectf mapped from pixels to points for the current Window.

Returns the number seconds which have elapsed since the active App launched.

Returns the number of animation frames which have elapsed since the active App launched.

DataSourceRef cinder::app::loadResource ( const std::string &  macPath,
int  mswID,
const std::string &  mswType 
)

Returns a DataSource to an application resource. On Mac OS X, macPath is a path relative to the bundle's resources folder. On Windows, mswID and mswType identify the resource as defined the application's .rc file(s).

See also:
Assets & Resources in Cinder
DataSourceRef cinder::app::loadResource ( const std::string &  macPath)

Returns a DataSource to an application resource. macPath is a path relative to the bundle's resources folder.

See also:
Assets & Resources in Cinder
DataSourceRef cinder::app::loadResource ( int  mswID,
const std::string &  mswType 
)

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

See also:
Assets & Resources in Cinder
DataSourceRef cinder::app::loadAsset ( const fs::path &  relativePath)

Returns a DataSourceRef to the active App's's asset. Throws a AssetLoadExc on failure.

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

Returns a fs::path to the active App's asset. Returns an empty path on failure.

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

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

Returns the path to the active App on disk.

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

Presents the user with a file-open 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. If the active app is in full-screen mode it will temporarily switch to windowed-mode to present the dialog.

Returns:
the selected file path or an empty string if the user cancelled.
fs::path cinder::app::getSaveFilePath ( const fs::path &  initialPath = "",
std::vector< std::string >  extensions = std::vector<std::string>() 
)

Presents the user with a file-save 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. If the active app is in full-screen mode it will temporarily switch to windowed-mode to present the dialog.

Returns:
the selected file path or an empty string if the user cancelled.
std::ostream& cinder::app::console ( )

Returns a reference to an output console, which is an alias to std::cout on the mac, and a wrapper around OutputDebugString on MSW.

On Mac OS X all output is echoed either to the Debugger Console in XCode or the system console On Windows output is echoed using OutputDebugString, echoed to the Output window of the debugger or to a stream viewable with Dbgview

 console() << "This line will be echoed" << std::endl; 

Returns a reference to the active App's Timeline.

Returns a copy of the current window's contents as a Surface8u.

Surface cinder::app::copyWindowSurface ( const Area &  area)

Returns a copy of the Area area from the current window's contents as a Surface8u.

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 display a dialog box or some other external window.

Returns a CGContextRef for drawing to the Window using CoreGraphics under Cocoa & Cocoa Touch. Assumes your App uses a Renderer2d.

std::ostream& cinder::app::operator<< ( std::ostream &  out,
const FileDropEvent &  event 
)
std::ostream& cinder::app::operator<< ( std::ostream &  out,
const TouchEvent::Touch &  touch 
)
std::ostream& cinder::app::operator<< ( std::ostream &  out,
const TouchEvent &  event 
)

Variable Documentation

Signal used for retrieving the supported orientations. BitwiseAndEventCombiner is used so that any connection can forbid a certain orientation.