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) (unidiff)
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 @@
1#include "exp004reshape.h"1#include "exp004reshape.h"
2#include "../view/exp004state0.h"2#include "../view/exp004state0.h"
3#include <GL/glut.h>3#include <GL/glut.h>
4#include <stdio.h>
5
6#define S exp004state0
47
5void8void
6exp004reshape (int w, int h)9exp004reshape (int w, int h)
@@ -17,39 +20,45 @@ exp004reshape (int w, int h)
1720
18 if (w <= h)21 if (w <= h)
19 { 22 {
20 exp004state0.ortho.min_x = 23 S.ortho.min_x =
21 exp004state0.ortho_min;24 S.ortho_min;
22 exp004state0.ortho.max_x = 25 S.ortho.max_x =
23 exp004state0.ortho_max;26 S.ortho_max;
24 exp004state0.ortho.min_y = 27 S.ortho.min_y =
25 exp004state0.ortho_min * (GLfloat) h / (GLfloat) w;28 S.ortho_min * (GLfloat) h / (GLfloat) w;
26 exp004state0.ortho.max_y = 29 S.ortho.max_y =
27 exp004state0.ortho_max * (GLfloat) h / (GLfloat) w;30 S.ortho_max * (GLfloat) h / (GLfloat) w;
28 }31 }
29 else32 else
30 {33 {
31 exp004state0.ortho.min_x =34 S.ortho.min_x =
32 exp004state0.ortho_min * (GLfloat) w / (GLfloat) h;35 S.ortho_min * (GLfloat) w / (GLfloat) h;
33 exp004state0.ortho.max_x =36 S.ortho.max_x =
34 exp004state0.ortho_max * (GLfloat) w / (GLfloat) h;37 S.ortho_max * (GLfloat) w / (GLfloat) h;
35 exp004state0.ortho.min_y =38 S.ortho.min_y =
36 exp004state0.ortho_min;39 S.ortho_min;
37 exp004state0.ortho.max_y =40 S.ortho.max_y =
38 exp004state0.ortho_max;41 S.ortho_max;
39 }42 }
4043
41 gluOrtho2D(exp004state0.ortho.min_x,44 gluOrtho2D(S.ortho.min_x,
42 exp004state0.ortho.max_x,45 S.ortho.max_x,
43 exp004state0.ortho.min_y,46 S.ortho.min_y,
44 exp004state0.ortho.max_y);47 S.ortho.max_y);
48
49 printf ("Ortho: %f %f %f %f\n",
50 S.ortho.min_x,
51 S.ortho.max_x,
52 S.ortho.min_y,
53 S.ortho.max_y);
4554
46 glMatrixMode (GL_MODELVIEW);55 glMatrixMode (GL_MODELVIEW);
4756
48 // Set the viewport equal to the size of the window.57 // Set the viewport equal to the size of the window.
49 glViewport (0, 0, (GLsizei) w, (GLsizei) h);58 glViewport (0, 0, (GLsizei) w, (GLsizei) h);
5059
51 exp004state0.viewport.w = w;60 S.viewport.w = w;
52 exp004state0.viewport.h = h;61 S.viewport.h = h;
5362
54 return;63 return;
55}64}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.