summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@drexel.edu>2009-06-16 23:27:16 (GMT)
committer Don Pellegrino <don@drexel.edu>2009-06-16 23:27:16 (GMT)
commit5ce19e150495d148c810bc655a5797d50d683bd4 (patch) (side-by-side diff)
tree65364ce4f00e743df8807317b27876e0242913e9
parent119f1ec5a99bafb30c20df3f5723e743217b6238 (diff)
downloadexp005-5ce19e150495d148c810bc655a5797d50d683bd4.zip
exp005-5ce19e150495d148c810bc655a5797d50d683bd4.tar.gz
exp005-5ce19e150495d148c810bc655a5797d50d683bd4.tar.bz2
Added define to make the code more readable.
-rw-r--r--src/controller/exp004reshape.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/controller/exp004reshape.c b/src/controller/exp004reshape.c
index 7aaff08..f3d7098 100644
--- a/src/controller/exp004reshape.c
+++ b/src/controller/exp004reshape.c
@@ -1,6 +1,9 @@
#include "exp004reshape.h"
#include "../view/exp004state0.h"
#include <GL/glut.h>
+#include <stdio.h>
+
+#define S exp004state0
void
exp004reshape (int w, int h)
@@ -17,39 +20,45 @@ exp004reshape (int w, int h)
if (w <= h)
{
- exp004state0.ortho.min_x =
- exp004state0.ortho_min;
- exp004state0.ortho.max_x =
- exp004state0.ortho_max;
- exp004state0.ortho.min_y =
- exp004state0.ortho_min * (GLfloat) h / (GLfloat) w;
- exp004state0.ortho.max_y =
- exp004state0.ortho_max * (GLfloat) h / (GLfloat) w;
+ S.ortho.min_x =
+ S.ortho_min;
+ S.ortho.max_x =
+ S.ortho_max;
+ S.ortho.min_y =
+ S.ortho_min * (GLfloat) h / (GLfloat) w;
+ S.ortho.max_y =
+ S.ortho_max * (GLfloat) h / (GLfloat) w;
}
else
{
- exp004state0.ortho.min_x =
- exp004state0.ortho_min * (GLfloat) w / (GLfloat) h;
- exp004state0.ortho.max_x =
- exp004state0.ortho_max * (GLfloat) w / (GLfloat) h;
- exp004state0.ortho.min_y =
- exp004state0.ortho_min;
- exp004state0.ortho.max_y =
- exp004state0.ortho_max;
+ S.ortho.min_x =
+ S.ortho_min * (GLfloat) w / (GLfloat) h;
+ S.ortho.max_x =
+ S.ortho_max * (GLfloat) w / (GLfloat) h;
+ S.ortho.min_y =
+ S.ortho_min;
+ S.ortho.max_y =
+ S.ortho_max;
}
- gluOrtho2D(exp004state0.ortho.min_x,
- exp004state0.ortho.max_x,
- exp004state0.ortho.min_y,
- exp004state0.ortho.max_y);
+ gluOrtho2D(S.ortho.min_x,
+ S.ortho.max_x,
+ S.ortho.min_y,
+ S.ortho.max_y);
+
+ printf ("Ortho: %f %f %f %f\n",
+ S.ortho.min_x,
+ S.ortho.max_x,
+ S.ortho.min_y,
+ S.ortho.max_y);
glMatrixMode (GL_MODELVIEW);
// Set the viewport equal to the size of the window.
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
- exp004state0.viewport.w = w;
- exp004state0.viewport.h = h;
+ S.viewport.w = w;
+ S.viewport.h = h;
return;
}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.