![]() |
Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
|
#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 | |
| Application * | m_app |
| Texture * | m_tex_arrow |
| Texture * | m_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 |
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.
| OwnCursor | ( | Application * | app | ) |
Constructs a ownCursor-object.
| app | The global application. |
Definition at line 3 of file OwnCursor.cpp.
|
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.
| cursorPosBeforeMove | The current cursor-position in visual space |
| deltaMotorSpace | Part of the cursor-offset in motor space with length of one |
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.
| cursorPosBeforeMove | The last cursor-position |
| deltaMotorSpace | The cursor-offset since the last frame in motor 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.
| time | The absolute frame time |
| timeDelta | Time since the last frame |
Definition at line 118 of file OwnCursor.cpp.
|
inline |
Accessor to the current cursor-icon.
Definition at line 85 of file OwnCursor.hpp.
|
inline |
Accessor to the cushion factor.
Definition at line 75 of file OwnCursor.hpp.
|
inline |
|
inline |
Accessor to 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.
| key | The key |
| pressed | Wheter 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.
| max | The new uppper bound for the scale-factor |
| void setMinScale | ( | float | min | ) |
Accessor to the lower bound of the scale-factor.
| min | The new lower bound for the scale-factor |
|
private |
Switches the actual cursor-icon.
Definition at line 19 of file OwnCursor.cpp.
|
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
| time | The absolute frame time |
| timeDelta | Time since the last frame |
Definition at line 106 of file OwnCursor.cpp.
|
private |
Accessor to the cushion factor
| value | The new cushion factor |
Definition at line 29 of file OwnCursor.cpp.
|
private |
Wheter the cursor-icon has changed since the last frame
Definition at line 16 of file OwnCursor.hpp.
|
private |
The global application
Definition at line 11 of file OwnCursor.hpp.
|
private |
Wheter the active cursor-icon blink has changed since the last frame
Definition at line 21 of file OwnCursor.hpp.
|
private |
The cushion-factor to manipulate the scaling-factor
Definition at line 22 of file OwnCursor.hpp.
|
private |
Timestamp of the last measure
Definition at line 15 of file OwnCursor.hpp.
|
private |
The last measured seconds per frame
Definition at line 14 of file OwnCursor.hpp.
|
private |
The upper bound for the scale-factor
Definition at line 20 of file OwnCursor.hpp.
|
private |
The lower bound for the scale-factor
Definition at line 19 of file OwnCursor.hpp.
|
private |
The scale-factor to accelerate or decelerate the cursor
Definition at line 18 of file OwnCursor.hpp.
|
private |
Wheter the scale-function has changed since the last frame
Definition at line 17 of file OwnCursor.hpp.
|
private |
The arrow-texture for the cursor
Definition at line 12 of file OwnCursor.hpp.
|
private |
The hand-texture for the cursor
Definition at line 13 of file OwnCursor.hpp.
1.8.7