Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OwnCursor Class Reference

#include <OwnCursor.hpp>

Public Member Functions

void onKeyStateChanged (int key, bool pressed)
 
 OwnCursor (Application *app)
 
void update (double time, double timeDelta)
 
void draw (double time, double timeDelta)
 
void setMinScale (float min)
 
void setMaxScale (float max)
 
float getScale ()
 
float getCushion ()
 
bool getScaleFunction ()
 
bool getCursorIcon ()
 
vec2 calculateCursorPosInVisualSpace (vec2 cursorPosBeforeMove, vec2 const &deltaMotorSpace)
 

Private Member Functions

vec2 calculateCursorMoveDeltaInVisualSpace (vec2 const &cursorPosBeforeMove, vec2 const &deltaMotorSpace)
 
void toggleImage ()
 
void toggleScaleFunction ()
 
void updateCushionFactor (float value)
 

Private Attributes

Applicationm_app
 
Texturem_tex_arrow
 
Texturem_tex_hand
 
double m_lastSpF
 
double m_lastMeasure
 
bool m_active_hand
 
bool m_scale_linear
 
float m_scale
 
float m_minScale
 
float m_maxScale
 
bool m_blink
 
float m_cushion_factor
 

Detailed Description

The OwnCursor-object draws the cursor-icon at the freshly calculated visual-space position. Parameters of the scale-function, to manipulate the movement from motor-space to visual-space, can be adjusted in OwnCursor-object.

Definition at line 9 of file OwnCursor.hpp.

Constructor & Destructor Documentation

OwnCursor ( Application app)

Constructs a ownCursor-object.

Parameters
appThe global application.

Definition at line 3 of file OwnCursor.cpp.

Member Function Documentation

vec2 calculateCursorMoveDeltaInVisualSpace ( vec2 const &  cursorPosBeforeMove,
vec2 const &  deltaMotorSpace 
)
private

Calculates the new cursor-position in visual space. To scale the cursor uniformly, this methode is called several times with an offset vector of length one, until the whole motor-offset vector has ben processed.

Parameters
cursorPosBeforeMoveThe current cursor-position in visual space
deltaMotorSpacePart of the cursor-offset in motor space with length of one
Returns
The updated cursor-position in visual space

Definition at line 71 of file OwnCursor.cpp.

vec2 calculateCursorPosInVisualSpace ( vec2  cursorPosBeforeMove,
vec2 const &  deltaMotorSpace 
)

Calculates the new cursor-position in visual space and in case of a cursor-movement updates the current cursor-position.

Parameters
cursorPosBeforeMoveThe last cursor-position
deltaMotorSpaceThe cursor-offset since the last frame in motor space
Returns
The new position of the cursor in visual space

Definition at line 48 of file OwnCursor.cpp.

void draw ( double  time,
double  timeDelta 
)

Draws the cursor with the current cursor-icon. The color and the scale of the cursor are scaled according to the scale-factor.

Parameters
timeThe absolute frame time
timeDeltaTime since the last frame

Definition at line 118 of file OwnCursor.cpp.

bool getCursorIcon ( )
inline

Accessor to the current cursor-icon.

Returns
The current cursor-icon

Definition at line 85 of file OwnCursor.hpp.

float getCushion ( )
inline

Accessor to the cushion factor.

Returns
The cushion-factor

Definition at line 75 of file OwnCursor.hpp.

float getScale ( )
inline

Accessor to the scale factor.

Returns
The scale-factor

Definition at line 70 of file OwnCursor.hpp.

bool getScaleFunction ( )
inline

Accessor to the current scale-function.

Returns
The current scale-function

Definition at line 80 of file OwnCursor.hpp.

void onKeyStateChanged ( int  key,
bool  pressed 
)

Callback for key-state-changes. Toggles the scale-function on F5-key (linear / inverse). Toggles the cursor-icon on F6-key (arrow / hand). Decrease cushion-factor on F7-key, by -0.05. Increase cushion-facotr on F8-key, by +0.05.

Parameters
keyThe key
pressedWheter the key is pressed or released

Definition at line 34 of file OwnCursor.cpp.

void setMaxScale ( float  max)

Accessor to the upper bound of the scale-factor.

Parameters
maxThe new uppper bound for the scale-factor
void setMinScale ( float  min)

Accessor to the lower bound of the scale-factor.

Parameters
minThe new lower bound for the scale-factor
void toggleImage ( )
private

Switches the actual cursor-icon.

Definition at line 19 of file OwnCursor.cpp.

void toggleScaleFunction ( )
private

Switches the actual scale-function.

Definition at line 24 of file OwnCursor.cpp.

void update ( double  time,
double  timeDelta 
)

Updates the ownCursor-object. Toggles m_blink every 0.3sec

Parameters
timeThe absolute frame time
timeDeltaTime since the last frame

Definition at line 106 of file OwnCursor.cpp.

void updateCushionFactor ( float  value)
private

Accessor to the cushion factor

Parameters
valueThe new cushion factor

Definition at line 29 of file OwnCursor.cpp.

Member Data Documentation

bool m_active_hand
private

Wheter the cursor-icon has changed since the last frame

Definition at line 16 of file OwnCursor.hpp.

Application* m_app
private

The global application

Definition at line 11 of file OwnCursor.hpp.

bool m_blink
private

Wheter the active cursor-icon blink has changed since the last frame

Definition at line 21 of file OwnCursor.hpp.

float m_cushion_factor
private

The cushion-factor to manipulate the scaling-factor

Definition at line 22 of file OwnCursor.hpp.

double m_lastMeasure
private

Timestamp of the last measure

Definition at line 15 of file OwnCursor.hpp.

double m_lastSpF
private

The last measured seconds per frame

Definition at line 14 of file OwnCursor.hpp.

float m_maxScale
private

The upper bound for the scale-factor

Definition at line 20 of file OwnCursor.hpp.

float m_minScale
private

The lower bound for the scale-factor

Definition at line 19 of file OwnCursor.hpp.

float m_scale
private

The scale-factor to accelerate or decelerate the cursor

Definition at line 18 of file OwnCursor.hpp.

bool m_scale_linear
private

Wheter the scale-function has changed since the last frame

Definition at line 17 of file OwnCursor.hpp.

Texture* m_tex_arrow
private

The arrow-texture for the cursor

Definition at line 12 of file OwnCursor.hpp.

Texture* m_tex_hand
private

The hand-texture for the cursor

Definition at line 13 of file OwnCursor.hpp.


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