summaryrefslogtreecommitdiffstats
path: root/DisplayClass.cpp
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-02-09 23:27:41 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-02-09 23:27:41 +0100
commite1290a7a045457d514518cfc5f928f613c962765 (patch)
tree8700b4880c007e4b636aa204e540ef0f3a067004 /DisplayClass.cpp
parentd605b3f57bec467e6be82c23f4fbd9d48cd3e9e1 (diff)
downloadc3d-e1290a7a045457d514518cfc5f928f613c962765.tar
c3d-e1290a7a045457d514518cfc5f928f613c962765.zip
schrottes tastenhandling
Diffstat (limited to 'DisplayClass.cpp')
-rw-r--r--DisplayClass.cpp53
1 files changed, 49 insertions, 4 deletions
diff --git a/DisplayClass.cpp b/DisplayClass.cpp
index 86c167c..70c59cb 100644
--- a/DisplayClass.cpp
+++ b/DisplayClass.cpp
@@ -16,16 +16,16 @@ DisplayClass::~DisplayClass() {
//delete tree;
}
-void DisplayClass::renderScene(unsigned long delta, std::bitset<256> keys) {
- angle += delta*0.025;
+void DisplayClass::renderScene(unsigned long delta, std::bitset<256>& keys) {
+ /*angle += delta*0.025;
if(angle >= 360)
- angle -= 360;
+ angle -= 360;*/
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity(); // Clean up matrix
glTranslatef(0.0, -2.0, -20.0); // Then set up transformation
- glRotatef(10, 1.0, 0.0, 0.0);
+// glRotatef(10, 1.0, 0.0, 0.0);
// glRotatef(angle, 0.0, 1.0, 0.0);
// glRotatef(angle*2, 1.0, 0.0, 0.0);
// glRotatef(angle*3, 0.0, 0.0, 1.0);
@@ -55,3 +55,48 @@ void DisplayClass::renderScene(unsigned long delta, std::bitset<256> keys) {
glFlush();
}
+
+void DisplayClass::keyhandler(std::bitset<256>& keys){
+ static float abstand = 0;
+ if(keys.any()) {
+ glLoadIdentity();
+
+ static float rotm[16] = {
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1};
+ char h = '2';
+ if(keys.test(h))
+ glRotatef(3, 1, 0, 0);
+
+ h = '4';
+ if(keys.test(h))
+ glRotatef(-3, 0, 1, 0);
+
+ h = '6';
+ if(keys.test(h))
+ glRotatef(3, 0, 1, 0);
+
+ h = '8';
+ if(keys.test(h))
+ glRotatef(-3, 1, 0, 0);
+
+ h = '+';
+ if(keys.test(h))
+ abstand -= 0.2;
+
+ h = '-';
+ if(keys.test(h))
+ abstand += 0.2;
+
+ glMultMatrixf(rotm);
+ glGetFloatv(GL_MODELVIEW_MATRIX, rotm);
+
+ glLoadIdentity();
+ glTranslatef(0, 0, abstand);
+ glMultMatrixf(rotm);
+
+// glutPostRedisplay();
+ }
+}