An abstraction of the view the scene is drawn into. More...

#include <View.h>

Public Types

typedef int UIView
 
typedef int BView
 

Public Member Functions

 View ()
 Constructor. More...
 
virtual ~View ()
 Virtual destructor. More...
 
bool initView (std::string windowTitle=bRenderer::DEFAULT_WINDOW_TITLE())
 Do all necessary initializations for the view to be ready to run (returns true in the case of success) More...
 
bool initView (bool fullscreen, std::string windowTitle=bRenderer::DEFAULT_WINDOW_TITLE())
 Do all necessary initializations for the view to be ready to run (returns true in the case of success) More...
 
bool initView (GLint width, GLint height, bool fullscreen=false, std::string windowTitle=bRenderer::DEFAULT_WINDOW_TITLE())
 Do all necessary initializations for the view to be ready to run (returns true in the case of success) More...
 
void terminateView ()
 Terminate the view. More...
 
bool isInitialized ()
 Returns true if the view has already been initialized. More...
 
bool isRunning ()
 Returns true if the view is running. More...
 
bool isFullscreen ()
 Returns true if the view runs in full screen mode. More...
 
GLint getWidth ()
 Returns the width of the view in pixels. More...
 
GLint getHeight ()
 Returns the height of the view in pixels. More...
 
void getSize (GLint *width, GLint *height)
 Gets the size of the view in pixels. More...
 
GLint getViewportWidth ()
 Returns the width of the OpenGL viewport in pixels. More...
 
GLint getViewportHeight ()
 Returns the height of the OpenGL viewport in pixels. More...
 
void getViewportSize (GLint *width, GLint *height)
 Gets the size of the OpenGL viewport in pixels. More...
 
GLfloat getAspectRatio ()
 Returns the aspect ratio of the view. More...
 
GLint getPositionX ()
 Returns the x position of the view in pixels. More...
 
GLint getPositionY ()
 Returns the y position of the view in pixels. More...
 
void getPosition (GLint *x, GLint *y)
 Gets the position of the upper left corner of the view. More...
 
GLFWwindow * getWindow ()
 Returns the GLFW window. More...
 
BViewgetUIView ()
 Returns the UIView on iOS (only usable in Objective C) More...
 
void attachToUIView (UIView *view)
 Attaches (adds as a subview) the underlying UIView to a UIView of your choosing. More...
 
void setFullscreen (bool fullscreen)
 Set fullscreen mode. More...
 
void setWidth (GLint width)
 Sets the width of the view in pixels. More...
 
void setHeight (GLint height)
 Sets the height of the view in pixels. More...
 
void setSize (GLint width, GLint height)
 Sets the size of the view in pixels. More...
 
void setViewportSize (GLint width, GLint height)
 Sets the size of the OpenGL viewport in pixels. More...
 
void setPosition (GLint x, GLint y)
 Sets the position of the upper left corner of the view. More...
 
void setContextCurrent ()
 Sets the context of this view to be current. More...
 
void bindFramebuffer ()
 Bind the framebuffer (on iOS only) More...
 
void presentBuffer ()
 Displays the buffer to the screen. More...
 

Static Public Member Functions

static GLint getScreenWidth ()
 Returns the width of the screen in pixels. More...
 
static GLint getScreenHeight ()
 Returns the height of the screen in pixels. More...
 
static void getScreenSize (GLint *width, GLint *height)
 Gets the size of the screen in pixels. More...
 
static void clearScreen ()
 Clears the screen. More...
 

Detailed Description

An abstraction of the view the scene is drawn into.

The view class represents a window on desktop systems or a UIView on iOS. It possesses an OpenGL context and allows for a scene to be displayed to the screen.

Author
Benjamin Buergisser

Member Typedef Documentation

typedef int View::BView
typedef int View::UIView

Constructor & Destructor Documentation

View::View ( )

Constructor.

virtual View::~View ( )
virtual

Virtual destructor.

Member Function Documentation

void View::attachToUIView ( UIView view)

Attaches (adds as a subview) the underlying UIView to a UIView of your choosing.

Parameters
[in]viewThe UIView to attach the view to
void View::bindFramebuffer ( )

Bind the framebuffer (on iOS only)

static void View::clearScreen ( )
static

Clears the screen.

GLfloat View::getAspectRatio ( )

Returns the aspect ratio of the view.

GLint View::getHeight ( )

Returns the height of the view in pixels.

void View::getPosition ( GLint *  x,
GLint *  y 
)

Gets the position of the upper left corner of the view.

Parameters
[out]xThe x position of the upper left corner of the view
[out]yThe y position of the upper left corner of the view
GLint View::getPositionX ( )

Returns the x position of the view in pixels.

GLint View::getPositionY ( )

Returns the y position of the view in pixels.

static GLint View::getScreenHeight ( )
static

Returns the height of the screen in pixels.

static void View::getScreenSize ( GLint *  width,
GLint *  height 
)
static

Gets the size of the screen in pixels.

Parameters
[out]widthThe width of the screen
[out]heightThe height of the screen
static GLint View::getScreenWidth ( )
static

Returns the width of the screen in pixels.

void View::getSize ( GLint *  width,
GLint *  height 
)

Gets the size of the view in pixels.

Parameters
[out]widthThe width of the view
[out]heightThe height of the view
BView* View::getUIView ( )

Returns the UIView on iOS (only usable in Objective C)

GLint View::getViewportHeight ( )

Returns the height of the OpenGL viewport in pixels.

void View::getViewportSize ( GLint *  width,
GLint *  height 
)

Gets the size of the OpenGL viewport in pixels.

Parameters
[out]widthThe width in pixels
[out]heightThe height in pixels
GLint View::getViewportWidth ( )

Returns the width of the OpenGL viewport in pixels.

GLint View::getWidth ( )

Returns the width of the view in pixels.

GLFWwindow* View::getWindow ( )

Returns the GLFW window.

This function returns the window created using GLFW. This is useful if GLFW functionality is used within the application. On iOS this function returns an integer set to 0.

bool View::initView ( std::string  windowTitle = bRenderer::DEFAULT_WINDOW_TITLE())

Do all necessary initializations for the view to be ready to run (returns true in the case of success)

Parameters
[in]windowTitleThe title for the window on desktop systems (optional)
bool View::initView ( bool  fullscreen,
std::string  windowTitle = bRenderer::DEFAULT_WINDOW_TITLE() 
)

Do all necessary initializations for the view to be ready to run (returns true in the case of success)

Parameters
[in]fullscreenDecides whether or not the application runs in full screen mode
[in]windowTitleThe title for the window on desktop systems (optional)
bool View::initView ( GLint  width,
GLint  height,
bool  fullscreen = false,
std::string  windowTitle = bRenderer::DEFAULT_WINDOW_TITLE() 
)

Do all necessary initializations for the view to be ready to run (returns true in the case of success)

Parameters
[in]widthThe width of the view in pixels
[in]heightThe height of the view in pixels
[in]fullscreenDecides whether or not the application runs in full screen mode (optional)
[in]windowTitleThe title for the window on desktop systems (optional)
bool View::isFullscreen ( )

Returns true if the view runs in full screen mode.

bool View::isInitialized ( )

Returns true if the view has already been initialized.

bool View::isRunning ( )

Returns true if the view is running.

void View::presentBuffer ( )

Displays the buffer to the screen.

void View::setContextCurrent ( )

Sets the context of this view to be current.

void View::setFullscreen ( bool  fullscreen)

Set fullscreen mode.

Parameters
[in]fullscreenSet true if full screen is desired
void View::setHeight ( GLint  height)

Sets the height of the view in pixels.

Parameters
[in]heightThe height in pixels
void View::setPosition ( GLint  x,
GLint  y 
)

Sets the position of the upper left corner of the view.

Parameters
[in]xThe x position of the upper left corner of the view
[in]yThe y position of the upper left corner of the view
void View::setSize ( GLint  width,
GLint  height 
)

Sets the size of the view in pixels.

Parameters
[in]widthThe width in pixels
[in]heightThe height in pixels
void View::setViewportSize ( GLint  width,
GLint  height 
)

Sets the size of the OpenGL viewport in pixels.

Parameters
[in]widthThe width in pixels
[in]heightThe height in pixels
void View::setWidth ( GLint  width)

Sets the width of the view in pixels.

Parameters
[in]widthThe width in pixels
void View::terminateView ( )

Terminate the view.