-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorldWindow.h
71 lines (58 loc) · 2.13 KB
/
WorldWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* CS559 Maze Project
*
* Class header file for the WorldWindow class. The WorldWindow is
* the window in which the viewer's view of the world is displayed.
*
* (c) Stephen Chenney, University of Wisconsin at Madison, 2001-2002
*
*/
#ifndef _WORLDWINDOW_H_
#define _WORLDWINDOW_H_
#include <Fl/Fl.h>
#include <Fl/Fl_Gl_Window.h>
#include "Ground.h"
#include "Track.h"
#include "SubDSphere.h"
#include "Buildings.h"
// Subclass the Fl_Gl_Window because we want to draw OpenGL in here.
class WorldWindow : public Fl_Gl_Window {
public:
// Constructor takes window position and dimensions, the title.
WorldWindow(int x, int y, int w, int h, char *label);
// draw() method invoked whenever the view changes or the window
// otherwise needs to be redrawn.
void draw(void);
// Event handling method. Uses only mouse events.
int handle(int);
// Update the world according to any events that have happened since
// the last time this method was called.
bool Update(float);
private:
Ground ground; // The ground object.
Track traintrack; // The train and track.
Buildings building;
SubDSphere sphere;
bool riding;
bool smooth;
static const double FOV_X; // The horizontal field of view.
float phi; // Viewer's inclination angle.
float theta; // Viewer's azimuthal angle.
float dist; // Viewer's distance from the look-at point.
float x_at; // The x-coord to look at.
float y_at; // The y-coord to look at. z_at is assumed 2.0.
int button; // The mouse button that is down, -1 if none.
int x_last; // The location of the most recent mouse event
int y_last;
int x_down; // The location of the mouse when the button was pushed
int y_down;
float phi_down; // The view inclination angle when the mouse
// button was pushed
float theta_down; // The view azimuthal angle when the mouse
// button was pushed
float dist_down; // The distance when the mouse button is pushed.
float x_at_down; // The x-coord to look at when the mouse went down.
float y_at_down; // The y-coord to look at when the mouse went down.
void Drag(float); // The function to call for mouse drag events
};
#endif