-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangulo.cpp
More file actions
39 lines (33 loc) · 896 Bytes
/
angulo.cpp
File metadata and controls
39 lines (33 loc) · 896 Bytes
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
#include "angulo.hpp"
using namespace std;
using namespace ed;
bool warp = false;
namespace ed{
void Angulo::mouseMovement(int x, int y)
{
int CenterX = glutGet(GLUT_WINDOW_WIDTH)/2;
int CenterY = glutGet(GLUT_WINDOW_HEIGHT)/2;
int diffx = x - CenterX;
int diffy = y - CenterY;
if(!warp)
{
warp = true;
setXrot(getXrot() + (float)diffy*0.25f);//xrot += (float) diffy; //set the xrot to xrot with the addition of the difference in the y position
setYrot(getYrot() + (float)diffx*0.25f);//yrot += (float) diffx; //set the xrot to yrot with the addition of the difference in the x position
if(getXrot() > 90.0)
setXrot(90.0);
else
if(getXrot() < -90.0)
setXrot(-90.0);
if(getYrot() < 0.0)
setYrot(getYrot() + 360.0);
else
if(getYrot() >= 360.0)
setYrot(getYrot() - 360.0);
}
else
{
warp = false;
}
}
}