# Cinder

# cinder::app Namespace Reference

## Classes
class | App
class | AppBasic
class | AppCinderView
class | AppCocoaTouch
class | AppImplMsw
class | AppImplMswBasic
class | AppImplMswRenderer
class | AppImplMswRendererGdi
class | AppImplMswRendererGl
class | AppImplMswScreenSaver
class | AppScreenSaver
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 | RendererGl
class | Renderer2d
struct | AppCocoaTouchState
## Functions
LRESULT CALLBACK | WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void | setupCocoaTouchWindow (AppCocoaTouch *app)
unsigned int | prepMouseEventModifiers (WPARAM wParam)
int | prepNativeKeyCode (WPARAM wParam)
char | mapVirtualKey (WPARAM wParam)
unsigned int | prepKeyEventModifiers ()
HWND | createDummyWindow (int *width, int *height, bool fullscreen)
App Free Functions
Convenience methods which mirror App member-functions and apply to the active application
int | getWindowWidth ()
| Returns the width of the active App's window measured in pixels, or the screen when in full-screen mode.
void | setWindowWidth (int windowWidth)
| Sets the width of the active App's window measured in pixels. Ignored in full-screen mode.
int | getWindowHeight ()
| Returns the height of the active App's window measured in pixels, or the screen when in full-screen mode.
void | setWindowHeight (int windowHeight)
| Sets the height of the active App's window measured in pixels. Ignored in full-screen mode.
void | setWindowSize (int windowWidth, int windowHeight)
| Sets the size of the active App's window. Ignored in full-screen mode.
Vec2f | getWindowCenter ()
| Returns the center of the active App's window or the screen in full-screen mode.
Vec2i | getWindowSize ()
| Returns the size of the active App's window or the screen in full-screen mode.
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.
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.
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 the width of the active App's window measured in pixels, or the screen when in full-screen mode.
DataSourcePathRef | loadResource (const std::string &macPath)
| Returns the width of the active App's window measured in pixels, or the screen when in full-screen mode.
std::string | getResourcePath (const std::string &rsrcRelativePath)
| Returns the width of the active App's window measured in pixels, or the screen when in full-screen mode.
DataSourceBufferRef | loadResource (int mswID, const std::string &mswType)
| Returns the width of the active App's window measured in pixels, or the screen when in full-screen mode.
std::string | getAppPath ()
| Returns the path to the active App on disk.
std::string | getOpenFilePath (const std::string &initialPath="", std::vector< std::string > extensions=std::vector< std::string >())
| Presents the user with a file-open dialog and returns the selected file path.
std::string | getSaveFilePath (const std::string &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.
Surface | copyWindowSurface ()
| Returns a copy of the window's contents as a Surface8u.
Surface | copyWindowSurface (const Area &area)
| Returns a copy of the Area area from the 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

## Function Documentation

int cinder::app::getWindowWidth | ( |  | ) |

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

void cinder::app::setWindowWidth | ( | int | windowWidth | ) |

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

int cinder::app::getWindowHeight | ( |  | ) |

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

void cinder::app::setWindowHeight | ( | int | windowHeight | ) |

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

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

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

Vec2f cinder::app::getWindowCenter | ( |  | ) |

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

Equivalent to

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

Vec2i cinder::app::getWindowSize | ( |  | ) |

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

float cinder::app::getWindowAspectRatio | ( |  | ) |

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

Area cinder::app::getWindowBounds | ( |  | ) |

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

Equivalent to

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

float cinder::app::getFrameRate | ( |  | ) |

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.

bool cinder::app::isFullScreen | ( |  | ) |

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.

double cinder::app::getElapsedSeconds | ( |  | ) |

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

uint32_t cinder::app::getElapsedFrames | ( |  | ) |

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 the width of the active App's window measured in pixels, or the screen when in full-screen mode.

DataSourcePathRef cinder::app::loadResource | ( | const std::string & | macPath | ) |

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

std::string cinder::app::getResourcePath | ( | const std::string & | rsrcRelativePath | ) |

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

DataSourceBufferRef cinder::app::loadResource | ( | int | mswID,
|  | const std::string & | mswType |
| ) |  |  |

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

std::string cinder::app::getAppPath | ( |  | ) |

Returns the path to the active App on disk.

std::string cinder::app::getOpenFilePath | ( | const std::string & | 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.

std::string cinder::app::getSaveFilePath | ( | const std::string & | 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;

Surface cinder::app::copyWindowSurface | ( |  | ) |

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

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

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

void cinder::app::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 cinder::app::createWindowCgContext | ( |  | ) |

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

LRESULT CALLBACK cinder::app::WndProc | ( | HWND | hWnd,
|  | UINT | uMsg,
|  | WPARAM | wParam,
|  | LPARAM | lParam |
| ) |  |  |

void cinder::app::setupCocoaTouchWindow | ( | AppCocoaTouch * | app | ) |

unsigned int cinder::app::prepMouseEventModifiers | ( | WPARAM | wParam | ) |

int cinder::app::prepNativeKeyCode | ( | WPARAM | wParam | ) |

char cinder::app::mapVirtualKey | ( | WPARAM | wParam | ) |

unsigned int cinder::app::prepKeyEventModifiers | ( |  | ) |

HWND cinder::app::createDummyWindow | ( | int * | width,
|  | int * | height,
|  | bool | fullscreen |
| ) |  |  |

## Variable Documentation

bool cinder::app::sMultisampleSupported = false

int cinder::app::sArbMultisampleFormat

int cinder::app::sKeyTable