Class responsible for the correct visualization of the elements on screen.
More...
#include <Camera.h>
Class responsible for the correct visualization of the elements on screen.
- Author
- Thales Lima Oliveira thale.nosp@m.s@uf.nosp@m.u.br
- Date
- 05/10/2017
Definition at line 30 of file Camera.h.
◆ Camera()
Definition at line 20 of file Camera.cpp.
21{
22 m_translation = wxPoint2DDouble(0, 0);
23 m_scale = 1.0;
24}
◆ ~Camera()
◆ GetMousePosition()
| wxPoint2DDouble Camera::GetMousePosition |
( |
bool |
worldCoords = true | ) |
const |
Definition at line 51 of file Camera.cpp.
52{
53 if(worldCoords) return ScreenToWorld(m_mousePosition);
54 return m_mousePosition;
55}
◆ GetScale()
| double Camera::GetScale |
( |
| ) |
const |
|
inline |
◆ GetTranslation()
| wxPoint2DDouble Camera::GetTranslation |
( |
| ) |
const |
|
inline |
Definition at line 42 of file Camera.h.
42{ return m_translation; }
◆ GetZoomMax()
| double Camera::GetZoomMax |
( |
| ) |
const |
|
inline |
◆ GetZoomMin()
| double Camera::GetZoomMin |
( |
| ) |
const |
|
inline |
◆ ScreenToWorld()
| wxPoint2DDouble Camera::ScreenToWorld |
( |
wxPoint2DDouble |
screenCoords | ) |
const |
Definition at line 27 of file Camera.cpp.
28{
29 return wxPoint2DDouble(screenCoords.m_x / m_scale - m_translation.m_x,
30 screenCoords.m_y / m_scale - m_translation.m_y);
31}
◆ SetScale() [1/2]
| void Camera::SetScale |
( |
double |
scale | ) |
|
|
inline |
◆ SetScale() [2/2]
| void Camera::SetScale |
( |
wxPoint2DDouble |
screenPoint, |
|
|
double |
delta |
|
) |
| |
Definition at line 38 of file Camera.cpp.
39{
40 m_translation -= screenPoint * (1.0 - m_scale) / m_scale;
41
42 m_scale += delta;
43
44
45 if(m_scale < m_zoomMin) m_scale = m_zoomMin;
46 if(m_scale > m_zoomMax) m_scale = m_zoomMax;
47
48 m_translation += screenPoint * (1.0 - m_scale) / m_scale;
49}
◆ SetTranslation()
| void Camera::SetTranslation |
( |
wxPoint2DDouble |
screenPoint | ) |
|
Definition at line 33 of file Camera.cpp.
34{
35 m_translation = screenPoint / m_scale - m_translationStartPt;
36}
◆ StartTranslation()
| void Camera::StartTranslation |
( |
wxPoint2DDouble |
startPoint | ) |
|
|
inline |
Definition at line 39 of file Camera.h.
39{ this->m_translationStartPt = startPoint; }
◆ UpdateMousePosition()
| void Camera::UpdateMousePosition |
( |
wxPoint2DDouble |
mousePosition | ) |
|
|
inline |
Definition at line 40 of file Camera.h.
40{ this->m_mousePosition = mousePosition; }
◆ m_mousePosition
| wxPoint2DDouble Camera::m_mousePosition |
|
protected |
◆ m_scale
◆ m_translation
| wxPoint2DDouble Camera::m_translation |
|
protected |
◆ m_translationStartPt
| wxPoint2DDouble Camera::m_translationStartPt |
|
protected |
◆ m_zoomMax
| double Camera::m_zoomMax = 3.0 |
|
protected |
◆ m_zoomMin
| double Camera::m_zoomMin = 0.01 |
|
protected |
The documentation for this class was generated from the following files: