File: Transforms.hpp

package info (click to toggle)
openlayer 2.1-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,368 kB
  • ctags: 2,295
  • sloc: ansic: 10,432; cpp: 9,890; xml: 109; makefile: 89; sh: 36
file content (108 lines) | stat: -rw-r--r-- 3,098 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef OL_TRANSFORMS_HPP
#define OL_TRANSFORMS_HPP

#include "Includes.hpp"
#include "Vec2D.hpp"
#include "Placement.hpp"
#include "Declspec.hpp"

//#include "Rgba.hpp"

namespace ol {


// Transforms - Global transformations class //
// Note that the transformations only apply to the objects which  //
// are renderd after the transformation is set //

// This class was renamed from Screen to Transforms for compability reasons //


// Advanced users: Note that the original transformation state is stored //
// in the matrix stack //


class Rgba;

class OL_LIB_DECLSPEC Transforms {
public:
   // Set the position of the whole screen (default: (0.0, 0.0)) //
   static void SetPosition( float x, float y );
   static void SetPosition( const Vec2D& pos );

   // Rotate the contents of the whole screen around the pivot (default: 0.0 ) //
   static void SetRotation( float angle );

   // Set the pivot point of the screen rotation (default: centre of the screen) //
   static void SetRotationPivot( float pivotX, float pivotY );
   static void SetRotationPivot( const Vec2D& pivot );

   // Sets the stretch of the whole screen, 1.0 is the normal size //
   static void SetStretch( float xStretch, float yStretch );
   static void SetStretch( const Vec2D& stretch );

	// Sets the current transform state to the
	static void SetPlacement( const Placement& placement, const Vec2D& pivot );

   // Get rid of all active position transformations //
   // NOTE: Empties the Transforms stack!! //
   static void ResetPlacement();

   // The old name of the ResetPlacement -function //
   inline static void ResetTransforms() {
      ResetPlacement();
   }
   

   // Pushes the placement state of Transforms (position, rotation and stretch) in a stack //
   static void PushPlacement();

   // Pops the placement state of Transforms from the stack (see above) //
   static void PopPlacement();


   // Tint the whole screen to a color (default: Rgba::INVISIBLE) //
   static void SetTintColor( const Rgba& color );

   // Sets the coefficients of the red, green, blue and alpha channels //
   // The default is Rgba::WHITE (all channels are 1.0) //
   static void SetColorChannels( const Rgba& cofficients );

   // Returns the coefficients of the color channels //
   static const Rgba& GetColorChannels();

   // You don't usually need to call any of the following functions //

   // Applies the active transformations //
   static void ApplyTransforms();

   // Applies the active tinting //
   static void ApplyTinting();


private:
   static bool transformationStored;
   static float x, y;
   static float angle;
   static float pivotX, pivotY;
   static float xStretch, yStretch;
   static Rgba color;
   static Rgba colorChannels;
   static int stackCounter;
};



// You can #define OL_USE_SCREEN_ALIAS to use //
// the name Screen instead of Transforms //

#ifdef OL_USE_SCREEN_ALIAS

   #define Screen Transforms

#endif // OL_USE_SCREEN_ALIAS


}

#endif // OL_TRANSFORMS_HPP