Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions

vl::Applet Class Reference

The Applet class is an utilitly UIEventListener that features a ghost manipulator, trackball manipulator, an FPS counter and a simple rendering pipeline. More...

#include <Applet.hpp>

Inheritance diagram for vl::Applet:
vl::UIEventListener vl::Object

List of all members.

Public Member Functions

 Applet ()
 Constructor.
void initialize ()
 Initializes the default rendering (with Rendering), the default scene manager (with SceneManagerActorTree) and camera manipulators (GhostCameraManipulator and TrackballManipulator).
virtual void addedListenerEvent (OpenGLContext *openglContext)
 Event generated whenever a listener is bound to an OpenGLContext context.
virtual void removedListenerEvent (OpenGLContext *)
 Event generated whenever a listener is unbound from an OpenGLContext context.
virtual void keyReleaseEvent (unsigned short, EKey key)
 Event generated when a key is released.
virtual void destroyEvent ()
 Event generated right before the bound OpenGLContext is destroyed.
virtual void updateEvent ()
 Event generated when the bound OpenGLContext does not have any other message to process and OpenGLContext::continuousUpdate() is set to true or somebody calls OpenGLContext::update().
virtual void resizeEvent (int, int)
 Event generated when the bound OpenGLContext is resized.
virtual void initEvent ()
 Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext.
virtual void enableEvent (bool)
 Event generated whenever setEnabled() is called.
virtual void mouseMoveEvent (int, int)
 Event generated when the mouse moves.
virtual void mouseUpEvent (EMouseButton, int, int)
 Event generated when one of the mouse buttons is released.
virtual void mouseDownEvent (EMouseButton, int, int)
 Event generated when one of the mouse buttons is pressed.
virtual void mouseWheelEvent (int)
 Event generated when the mouse wheel rotated.
virtual void keyPressEvent (unsigned short, EKey)
 Event generated when a key is pressed.
virtual void fileDroppedEvent (const std::vector< String > &)
 Event generated when one or more files are dropped on the bound OpenGLContext's area.
virtual void visibilityEvent (bool)
 Event generated when the bound OpenGLContext is shown or hidden.
RenderingAbstractrendering ()
 The rendering used by the Applet, by default a Rendering.
const RenderingAbstractrendering () const
 The rendering used by the Applet, by default a Rendering.
void setRendering (RenderingAbstract *rendering)
 Sets the rendering used by the Applet, by default a Rendering.
SceneManagerActorTreesceneManager ()
 The scene manager used by the default rendering.
const SceneManagerActorTreesceneManager () const
 The scene manager used by the default rendering.
void setGhostCameraManipulator (GhostCameraManipulator *gcm)
 GhostCameraManipulator used by the applet, activated by the "F" key.
GhostCameraManipulatorghostCameraManipulator ()
 GhostCameraManipulator used by the applet, activated by the "F" key.
const GhostCameraManipulatorghostCameraManipulator () const
void setTrackball (TrackballManipulator *trackball)
 TrackballManipulator used by the applet, activated by the "T" key.
TrackballManipulatortrackball ()
 TrackballManipulator used by the applet, activated by the "T" key.
const TrackballManipulatortrackball () const
double fps () const
 Current average frames per second (updated every 500ms).
virtual void updateScene ()
 Override this to update the content of your scene.
void setAppletName (const String &app_name)
 Sets the applet name, used for the window title and for naming screenshots.
const StringappletName () const
 The applet name, used for the window title and for naming screenshots.

Protected Member Functions

void bindManipulators (Camera *camera)

Detailed Description

The Applet class is an utilitly UIEventListener that features a ghost manipulator, trackball manipulator, an FPS counter and a simple rendering pipeline.

Default key bindings:

Definition at line 60 of file Applet.hpp.


Constructor & Destructor Documentation

Applet::Applet (  )

Constructor.

Definition at line 44 of file Applet.cpp.

References vl::Time::currentTime(), and VL_DEBUG_SET_OBJECT_NAME.


Member Function Documentation

void Applet::initialize (  )

Initializes the default rendering (with Rendering), the default scene manager (with SceneManagerActorTree) and camera manipulators (GhostCameraManipulator and TrackballManipulator).

Definition at line 54 of file Applet.cpp.

References vl::Object::as(), bindManipulators(), vl::ref< T >::get(), rendering(), sceneManager(), and setRendering().

void Applet::addedListenerEvent ( OpenGLContext  ) [virtual]

Event generated whenever a listener is bound to an OpenGLContext context.

Implements vl::UIEventListener.

Definition at line 168 of file Applet.cpp.

References vl::OpenGLContext::addEventListener(), vl::ref< T >::get(), NULL, and VL_CHECK.

void Applet::removedListenerEvent ( OpenGLContext  ) [virtual]

Event generated whenever a listener is unbound from an OpenGLContext context.

Implements vl::UIEventListener.

Definition at line 179 of file Applet.cpp.

References vl::ref< T >::get(), and vl::OpenGLContext::removeEventListener().

void Applet::keyReleaseEvent ( unsigned  unicode_ch,
EKey  key 
) [virtual]
void Applet::destroyEvent (  ) [virtual]

Event generated right before the bound OpenGLContext is destroyed.

Implements vl::UIEventListener.

Definition at line 185 of file Applet.cpp.

References NULL.

void Applet::updateEvent (  ) [virtual]
void Applet::resizeEvent ( int  x,
int  y 
) [virtual]
virtual void vl::Applet::initEvent (  ) [inline, virtual]

Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext.

Implements vl::UIEventListener.

Definition at line 88 of file Applet.hpp.

virtual void vl::Applet::enableEvent ( bool  enabled ) [inline, virtual]

Event generated whenever setEnabled() is called.

Implements vl::UIEventListener.

Definition at line 90 of file Applet.hpp.

virtual void vl::Applet::mouseMoveEvent ( int  x,
int  y 
) [inline, virtual]

Event generated when the mouse moves.

Implements vl::UIEventListener.

Definition at line 92 of file Applet.hpp.

virtual void vl::Applet::mouseUpEvent ( EMouseButton  button,
int  x,
int  y 
) [inline, virtual]

Event generated when one of the mouse buttons is released.

Implements vl::UIEventListener.

Definition at line 94 of file Applet.hpp.

virtual void vl::Applet::mouseDownEvent ( EMouseButton  button,
int  x,
int  y 
) [inline, virtual]

Event generated when one of the mouse buttons is pressed.

Implements vl::UIEventListener.

Definition at line 96 of file Applet.hpp.

virtual void vl::Applet::mouseWheelEvent ( int  n ) [inline, virtual]

Event generated when the mouse wheel rotated.

Implements vl::UIEventListener.

Definition at line 98 of file Applet.hpp.

virtual void vl::Applet::keyPressEvent ( unsigned  unicode_ch,
EKey  key 
) [inline, virtual]

Event generated when a key is pressed.

Implements vl::UIEventListener.

Definition at line 100 of file Applet.hpp.

virtual void vl::Applet::fileDroppedEvent ( const std::vector< String > &  files ) [inline, virtual]

Event generated when one or more files are dropped on the bound OpenGLContext's area.

Implements vl::UIEventListener.

Definition at line 102 of file Applet.hpp.

virtual void vl::Applet::visibilityEvent ( bool  visible ) [inline, virtual]

Event generated when the bound OpenGLContext is shown or hidden.

Implements vl::UIEventListener.

Definition at line 104 of file Applet.hpp.

RenderingAbstract* vl::Applet::rendering (  ) [inline]

The rendering used by the Applet, by default a Rendering.

Definition at line 109 of file Applet.hpp.

Referenced by initialize(), keyReleaseEvent(), resizeEvent(), and updateEvent().

const RenderingAbstract* vl::Applet::rendering (  ) const [inline]

The rendering used by the Applet, by default a Rendering.

Definition at line 112 of file Applet.hpp.

void vl::Applet::setRendering ( RenderingAbstract rendering ) [inline]

Sets the rendering used by the Applet, by default a Rendering.

Definition at line 115 of file Applet.hpp.

Referenced by initialize().

SceneManagerActorTree* vl::Applet::sceneManager (  ) [inline]

The scene manager used by the default rendering.

Definition at line 118 of file Applet.hpp.

Referenced by initialize().

const SceneManagerActorTree* vl::Applet::sceneManager (  ) const [inline]

The scene manager used by the default rendering.

Definition at line 121 of file Applet.hpp.

void vl::Applet::setGhostCameraManipulator ( GhostCameraManipulator gcm ) [inline]

GhostCameraManipulator used by the applet, activated by the "F" key.

Definition at line 124 of file Applet.hpp.

GhostCameraManipulator* vl::Applet::ghostCameraManipulator (  ) [inline]

GhostCameraManipulator used by the applet, activated by the "F" key.

Definition at line 127 of file Applet.hpp.

const GhostCameraManipulator* vl::Applet::ghostCameraManipulator (  ) const [inline]

Definition at line 128 of file Applet.hpp.

void vl::Applet::setTrackball ( TrackballManipulator trackball ) [inline]

TrackballManipulator used by the applet, activated by the "T" key.

Definition at line 131 of file Applet.hpp.

TrackballManipulator* vl::Applet::trackball (  ) [inline]

TrackballManipulator used by the applet, activated by the "T" key.

Definition at line 134 of file Applet.hpp.

const TrackballManipulator* vl::Applet::trackball (  ) const [inline]

Definition at line 135 of file Applet.hpp.

double vl::Applet::fps (  ) const [inline]

Current average frames per second (updated every 500ms).

Definition at line 138 of file Applet.hpp.

virtual void vl::Applet::updateScene (  ) [inline, virtual]

Override this to update the content of your scene.

Called by updateEvent() right before rendering()->render() and swapping opengl front/back buffers.

Note:
Since updateScene() is called by updateEvent() this function is called only if somebody requests a OpenGLContext::update() or if OpenGLContext::continuousUpdate() is set to true.

Definition at line 146 of file Applet.hpp.

Referenced by updateEvent().

void vl::Applet::setAppletName ( const String app_name ) [inline]

Sets the applet name, used for the window title and for naming screenshots.

Definition at line 149 of file Applet.hpp.

const String& vl::Applet::appletName (  ) const [inline]

The applet name, used for the window title and for naming screenshots.

Definition at line 152 of file Applet.hpp.

Referenced by keyReleaseEvent().

void Applet::bindManipulators ( Camera camera ) [protected]

Definition at line 160 of file Applet.cpp.

References NULL.

Referenced by initialize().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:08.
Permission is granted to use this page to write and publish articles regarding Visualization Library.