2011-10-19 01:10:15 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <math.h>
|
2011-12-06 22:35:48 +01:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gtk/gtkgl.h>
|
|
|
|
#include <GL/glut.h>
|
2012-01-15 03:35:36 +01:00
|
|
|
#include <glade/glade.h>
|
2011-10-19 01:10:15 +02:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "input.h"
|
2011-10-30 23:55:53 +01:00
|
|
|
#include "display.h"
|
2011-10-19 01:10:15 +02:00
|
|
|
|
2012-01-15 03:35:36 +01:00
|
|
|
#include "../firmware/globals.h"
|
2011-10-31 00:25:07 +01:00
|
|
|
|
2011-12-27 18:48:15 +01:00
|
|
|
void moveCameraPosition(gfloat direction) {
|
2011-10-19 01:10:15 +02:00
|
|
|
eyePos += direction;
|
|
|
|
if (eyePos > 360.0) eyePos = 0.0;
|
|
|
|
|
2011-12-27 18:48:15 +01:00
|
|
|
lookX = sin(eyePos * M_PI/180.0)*70.0;
|
|
|
|
lookZ = cos(eyePos * M_PI/180.0)*70.0;
|
2011-10-19 01:10:15 +02:00
|
|
|
}
|
|
|
|
|
2011-12-27 18:48:15 +01:00
|
|
|
void moveCameraAngle(gfloat angle) {
|
2011-10-19 01:10:15 +02:00
|
|
|
eyeAngle += angle;
|
|
|
|
if (eyeAngle > 120) eyeAngle = 120;
|
|
|
|
if (eyeAngle < 0) eyeAngle = 0;
|
|
|
|
}
|
|
|
|
|
2011-12-27 18:48:15 +01:00
|
|
|
void mouse(gint x, gint y) {
|
|
|
|
gint position, viewport[4];
|
2011-12-21 22:58:57 +01:00
|
|
|
GLubyte pixel[3];
|
2011-10-30 23:55:53 +01:00
|
|
|
|
2011-12-21 22:58:57 +01:00
|
|
|
glGetIntegerv(GL_VIEWPORT, viewport);
|
|
|
|
glReadPixels(x, viewport[3]-y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, (void*)pixel);
|
2011-12-27 18:48:15 +01:00
|
|
|
position = ((gint)pixel[2]/8)-1; // Selected LED
|
2011-10-30 23:55:53 +01:00
|
|
|
|
2012-01-15 22:43:32 +01:00
|
|
|
animation[currentFrame][position] = animation[currentFrame][position] == 0 ? 1 : 0;
|
2012-01-15 03:35:36 +01:00
|
|
|
displayCurrentFrame();
|
2011-10-30 23:55:53 +01:00
|
|
|
}
|
|
|
|
|