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. */
10 #define __VISUALIZER__
14 #include "drawing_primitives.h"
19 #include <GLUT/glut.h>
21 #include <GL/glut.h> // Linux, Windows
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
31 Rect bounds
; // area expected to be filled by computer
32 int left
,top
; // screen location of window
35 int width
,height
; // pixel size of window
38 Visualizer(Args
* args
);
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
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__