3 #include "SDL_opengl.h"
8 void View::Translate(Real x, Real y)
16 void View::ScaleAroundPoint(Real x, Real y, Real scaleAmt)
18 // Convert to local coords.
24 Debug("Mouse wheel event %f %f %f\n", Float(x), Float(y), Float(scaleAmt));
26 Real top = y - m_bounds.y;
27 Real left = x - m_bounds.x;
32 m_bounds.x = x - left;
34 m_bounds.w *= scaleAmt;
35 m_bounds.h *= scaleAmt;
40 static bool debug_output_done = false;
41 if (!debug_output_done)
43 m_document.DebugDumpObjects();
44 debug_output_done = true;
47 glClearColor(1.f,1.f,1.f,1.f);
48 glClear(GL_COLOR_BUFFER_BIT);
50 glMatrixMode(GL_PROJECTION);
52 glOrtho(Float(m_bounds.x), Float(m_bounds.x)+Float(m_bounds.w), Float(m_bounds.y) + Float(m_bounds.h), Float(m_bounds.y), -1.f, 1.f);
53 glMatrixMode(GL_MODELVIEW);
56 glColor4f(0.f,0.f,0.f,1.f);
58 for (unsigned id = 0; id < m_document.ObjectCount(); ++id)
60 if (m_document.m_objects.types[id] == RECT_FILLED)
62 Rect obj_bounds = m_document.m_objects.bounds[id];
63 glVertex2f(Float(obj_bounds.x), Float(obj_bounds.y));
64 glVertex2f(Float(obj_bounds.x) + Float(obj_bounds.w), Float(obj_bounds.y));
65 glVertex2f(Float(obj_bounds.x) + Float(obj_bounds.w), Float(obj_bounds.y) + Float(obj_bounds.h));
66 glVertex2f(Float(obj_bounds.x), Float(obj_bounds.y) + Float(obj_bounds.h));
70 for (unsigned id = 0; id < m_document.ObjectCount(); ++id)
72 if (m_document.m_objects.types[id] == RECT_OUTLINE)
74 Rect obj_bounds = m_document.m_objects.bounds[id];
75 glBegin(GL_LINE_LOOP);
76 glVertex2f(Float(obj_bounds.x), Float(obj_bounds.y));
77 glVertex2f(Float(obj_bounds.x) + Float(obj_bounds.w), Float(obj_bounds.y));
78 glVertex2f(Float(obj_bounds.x) + Float(obj_bounds.w), Float(obj_bounds.y) + Float(obj_bounds.h));
79 glVertex2f(Float(obj_bounds.x), Float(obj_bounds.y) + Float(obj_bounds.h));