-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.cpp
72 lines (45 loc) · 1.14 KB
/
events.cpp
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
/*
* This file includes anything and everything to do with processing events.
*
*
*
*
*/
#include "config.h"
#include <GL/glut.h>
#include <stdio.h>
#include "display.h"
#include "Cursor/WiiCursor.h"
void reshape(int w, int h)
{
GetDisplayed()->Reshape(w, h);
/*
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(FOV, (GLfloat) w/ (GLfloat) h, 40, 5000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
*/
}
void mouse(int button, int state, int x, int y)
{
int width = glutGet(GLUT_WINDOW_WIDTH);
int height = glutGet(GLUT_WINDOW_HEIGHT);
//printf("Width = %i, H = %i\n", width, height);
int cursorX = ((float)x/(float)width)*1024.0;
int cursorY = ((float)y/(float)height)*768.0;
//printf("Inside mouse: (%i, %i)\n", cursorX, cursorY);
_cursor->ProcessCoordinates(cursorX, cursorY, cursorX, cursorY);
int points[2];
_cursor->GetCurrentCursor(points);
GetDisplayed()->Select(points[0], points[1]);
}
void keyboard(unsigned char key, int x, int y)
{
if (key == 'r')
GetDisplayed()->Reset();
}
void specialKeyboard(int key, int x, int y)
{
}