StarTrekV3_Linux  Version3
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
Paralax.h
Go to the documentation of this file.
1 //
2 // ___.--------._____________,------' -----.`----._
3 // \ ` - . _ /\
4 // `.__________ ` - | | __,---"-._
5 // `-----------.______ ,'_/ ________,------'___________`----.___________
6 // `-----.____,' \===========================================/
7 // | :| >--------------.----------.---------------'
8 // / :| _,--' ,--' `--.__.--'
9 // / : |--'______________/_
10 // ,---,' : \__________________`--.
11 // `__________ |/|
12 // `------._ |\|
13 // `--._________,-'
14 //
15 //
16 //
17 // Credits go to Paramount pictures for the star - trek concept and universe.
18 
19 
20 // Copyright (C) 2015 - 2016 E.J.M. Martens
21 //
22 // This program is free software; you can redistribute it and/or
23 // modify it under the terms of the GNU General Public License
24 // as published by the Free Software Foundation; either version 2
25 // of the License, or (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU General Public License for more details.
31 //
32 // You should have received a copy of the GNU General Public License
33 // along with this program; if not, write to the Free Software
34 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 
36 
37 #ifndef _PARALAX
38 #define _PARALAX
39 #include <allegro5/allegro.h>
40 #include <allegro5/allegro_primitives.h>
41 #include <vector>
42 #include <cmath>
43 
44 
45 using namespace std;
46 
47 
48 
49 struct TStar
50 {
51  double m_dX,m_dY;
52  int m_nZ;
53 };
54 
55 
56 class Paralax
57 {
58  public:
59  Paralax(int a_nWidth, int a_nHeight, int a_nNumberOfStars, int a_nLayers);
60  ~Paralax();
61 
62  void Move(double a_dX, double a_dY);
63  void Draw(ALLEGRO_DISPLAY * a_pDisplay, int a_nWarp = 0, double a_dAngle = 0);
64 
65 
66  protected:
67 
68 
69  private:
70  double m_dOldX;
71  double m_dOldY;
72  int m_nWidth;
73  int m_nHeight;
74  int m_nLayers;
75  int m_nNumberOfStars;
76 
77  ALLEGRO_LOCKED_REGION * pLockedRegion;
78 
79  vector<ALLEGRO_COLOR> m_vStarColor;
80  vector<TStar> m_vStar;
81 
82 
83 };
84 
85 
86 #endif // _PARALAX
Definition: Paralax.h:56
double m_dY
Definition: Paralax.h:51
int m_nZ
Definition: Paralax.h:52
Definition: Paralax.h:49