-
Notifications
You must be signed in to change notification settings - Fork 2
/
graphics.h
50 lines (41 loc) · 1.67 KB
/
graphics.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
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <Imagine/Graphics.h>
#include "algebra.h"
#include <assert.h>
class MyShape;
class MyPolygon;
class MyCircle;
struct ViewLayout{
int winWidth,winHeight;
double viewZoneLeft,viewZoneRight,viewZoneUp,viewZoneBottom;
double oneMeterLengthOnScreen;
double viewWidth,viewHeight;
double ratioWidth,ratioHeight;
Vector2 viewCenter;
ViewLayout(int windowWidth, int windowHeight);
void UpdateViewZone();
void coordTranslate(double x,double y,int& x_onScreen,int& y_onScreen);
void coordTranslateInverse(int x_onScreen, int y_onScreen, double& realX, double& realY);
};
class GraphicManager{
ViewLayout viewLayout;
int frameCountPrintScreen;
public:
GraphicManager(int windowW, int windowH);
void coordTranslate(double x,double y,int& x_onScreen,int& y_onScreen);
void coordTranslateInverse(int x_onScreen, int y_onScreen, double& realX, double& realY);
void myDisplay(std::vector<MyShape*> shapeList, Imagine::Color col=Imagine::BLACK);
void draw_each(MyShape* s, Imagine::Color col=Imagine::BLACK, bool drawID=false);
void drawAxis();
void myDrawPoint(const Vector2&,int radius=2,Imagine::Color col=Imagine::RED);
void myDrawPolygon(MyPolygon &p, Imagine::Color col=Imagine::BLACK, bool drawID=false);
void myDrawCircle(MyCircle &p, Imagine::Color col=Imagine::BLACK, bool drawID=false);
void myDrawLine(double x1, double y1, double x2, double y2, Imagine::Color col, int penWidth=1);
void myNoRefreshPush();
void myNoRefreshPop();
void myMilliSleep(int milliSec);
void ajustViewZoom(Vector2 move,double zoom);
void savePrintScreen();
};
#endif // GRAPHICS_H