forked from mhernando/Apolo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drawscene.h
75 lines (52 loc) · 1.56 KB
/
drawscene.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
#pragma once
#include "base/globject.h"
#include <string>
#include <vector>
#define UP_ARROW 119
#define LEFT_ARROW 97
#define DOWN_ARROW 115
#define RIGHT_ARROW 100
using namespace std;
class DrawScene
{
public:
DrawScene();
virtual ~DrawScene();
//Serializers
void writeToStream(Stream& stream);
void readFromStream(Stream& stream);
//file helpers, use .glscene extension
bool save(string filename);//without extension
bool load(string filename);//without extension
//Initizalization
void init();//enable lights
void setViewSize(int width, int height);
//Object Managers
void setObjects(vector<GLObject*> v);
void clearObjects();
void addObject(GLObject* object);
void removeObject(GLObject* object);
void setMap(GLObject* map, double initX, double initY, double width, double height);
//Event managers
void Draw();
void KeyDown(unsigned char key);
//void SpecialKeyDown(unsigned char key);
void MouseMove(int x,int y);//The mouse coordinates
void MouseButton(int x,int y,int button,bool down,bool shiftKey, bool ctrlKey);
//info
void GetViewPoint(double&xi, double& yi,double& xf, double& yf){xi=initX;yi=initY;xf=finalX;yf=finalY;}
void SetViewPoint(double xi, double yi,double xf, double yf){initX=xi;initY=yi;finalX=xf;finalY=yf;}
void SetGridSize(float size){gridsize=size;}
protected:
vector<GLObject*> object;
vector<GLObject*> loadedObjects;
//visualization
double initX,initY,finalX,finalY;
bool showGrid,showFrame;
bool controlKey;
bool shiftKey;
bool leftButton;
bool rightButton;
bool midButton;
float gridsize;
};