-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewport.h
71 lines (55 loc) · 1.51 KB
/
viewport.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
#ifndef VIEWPORT_H
#define VIEWPORT_H
#include <QFrame>
#include <QPainter>
#include <QVector>
#include <QMouseEvent>
#include <QDebug>
#include <QKeyEvent>
#include <QFocusEvent>
#include "phobject.h"
#define MAX_INT_VALUE 100000000 //2147480000
//2000000000
//Отображает графику
class Viewport : public QFrame
{
Q_OBJECT
private:
QVector<PhObject> ToPaintVector;
QColor background_color;
double camX, camY;
double distance_scale;
double MAX_DISTANCE_SCALE;
double MIN_DISTANCE_SCALE;
double SCROLL_SPEED;
double bufferX, bufferY;
double sim_speed;
int alpha;
protected:
virtual void paintEvent(QPaintEvent*);
virtual void wheelEvent(QWheelEvent *e);
virtual void mouseMoveEvent(QMouseEvent *p);
virtual void mousePressEvent(QMouseEvent* p);
public:
explicit Viewport(QWidget *parent = nullptr);
int getCamX();
int getCamY();
void setCamX(int xp);
void setCamY(int yp);
void setCamPos(int xp = 0, int yp = 0);
void setScrollSpeed(double val);
void setScale(double val);
double getScrollSpeed();
double getScale();
void setAlpha(int alpha);
void setBackgroundColor(QColor color);
double* getPointerCamX();
double* getPointerCamY();
QColor* getBackgroundcolorPointer() { return &background_color; }
void setPaintVector(QVector<PhObject>& vec);
signals:
void whellScrolled(double value);
void camScrolled();
void replaceCamSignal();
};
#endif // VIEWPORT_H