Preliminary, but functional, autotoolsification
[proto.git] / src / shared / visualizer.h
blobf95b7c2882234be90bd7befc9e4c22f557217a5c
1 /* OpenGL container for drawing
2 Copyright (C) 2005-2008, Jonathan Bachrach, Jacob Beal, and contributors
3 listed in the AUTHORS file in the MIT Proto distribution's top directory.
5 This file is part of MIT Proto, and is distributed under the terms of
6 the GNU General Public License, with a linking exception, as described
7 in the file LICENSE in the MIT Proto distribution's top directory. */
9 #ifndef __VISUALIZER__
10 #define __VISUALIZER__
12 #include "utils.h"
14 #include "drawing_primitives.h"
15 #include "palette.h"
17 #ifdef WANT_GLUT
18 #ifdef MACOSX
19 #include <GLUT/glut.h>
20 #else
21 #include <GL/glut.h> // Linux, Windows
22 #endif
23 #endif // WANT_GLUT
25 extern Palette* palette; // current palette
27 class Visualizer : public EventConsumer {
28 BOOL is_full_screen; // is the window in fullscreen mode?
29 int window; // identifier for window
30 flo aspect_ratio;
31 Rect bounds; // area expected to be filled by computer
32 int left,top; // screen location of window
33 Palette* my_palette;
34 public:
35 int width,height; // pixel size of window
37 public:
38 Visualizer(Args* args);
39 ~Visualizer();
41 void set_bounds(Rect* r) {
42 bounds.t=r->t; bounds.l=r->l; bounds.b=r->b; bounds.r=r->r; }
43 void resize(int width, int height);
44 BOOL handle_key(KeyEvent* key);
45 BOOL handle_mouse(MouseEvent* mouse); // handle clicks and drags
46 void visualize(); // visualizer's contribution to frame
48 void prepare_frame(); // start drawing a frame
49 void view_3D(); // shift from 2D overlay to spatial computer drawing mode
50 void end_3D(); // shift back to 2D overlay for final drawing
51 void complete_frame(); // finish drawing a frame
53 // selection routines
54 void start_select_3D(Rect* rgn, int max_names);
55 void end_select_3D(int max_names, Population* result);
56 void click_3d(int winx, int winy, double *pt);
59 #endif // __VISUALIZER__