Right click camera; minor CCamera cleanups
parent
d9ccd6edf3
commit
47d39e5b22
|
@ -636,16 +636,6 @@ struct MouseButtonEventData : public EventData
|
||||||
MouseButton button = MOUSE_BUTTON_LEFT;
|
MouseButton button = MOUSE_BUTTON_LEFT;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum WheelDirection
|
|
||||||
* \brief Direction of mouse wheel movement
|
|
||||||
*/
|
|
||||||
enum WheelDirection
|
|
||||||
{
|
|
||||||
WHEEL_UP,
|
|
||||||
WHEEL_DOWN
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct MouseWheelEventData
|
* \struct MouseWheelEventData
|
||||||
* \brief Additional data for mouse wheel event.
|
* \brief Additional data for mouse wheel event.
|
||||||
|
|
|
@ -98,11 +98,6 @@ CCamera::CCamera()
|
||||||
m_normLookat = Math::Vector(0.0f, 0.0f, 0.0f);
|
m_normLookat = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||||
m_focus = 1.0f;
|
m_focus = 1.0f;
|
||||||
|
|
||||||
m_rightDown = false;
|
|
||||||
m_rightPosInit = Math::Point(0.5f, 0.5f);
|
|
||||||
m_rightPosCenter = Math::Point(0.5f, 0.5f);
|
|
||||||
m_rightPosMove = Math::Point(0.5f, 0.5f);
|
|
||||||
|
|
||||||
m_eyePt = Math::Vector(0.0f, 0.0f, 0.0f);
|
m_eyePt = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||||
m_directionH = 0.0f;
|
m_directionH = 0.0f;
|
||||||
m_directionV = 0.0f;
|
m_directionV = 0.0f;
|
||||||
|
@ -130,12 +125,6 @@ CCamera::CCamera()
|
||||||
|
|
||||||
m_remotePan = 0.0f;
|
m_remotePan = 0.0f;
|
||||||
|
|
||||||
m_mouseDirH = 0.0f;
|
|
||||||
m_mouseDirV = 0.0f;
|
|
||||||
m_mouseMarging = 0.01f;
|
|
||||||
|
|
||||||
m_motorTurn = 0.0f;
|
|
||||||
|
|
||||||
m_centeringPhase = CAM_PHASE_NULL;
|
m_centeringPhase = CAM_PHASE_NULL;
|
||||||
m_centeringAngleH = 0.0f;
|
m_centeringAngleH = 0.0f;
|
||||||
m_centeringAngleV = 0.0f;
|
m_centeringAngleV = 0.0f;
|
||||||
|
@ -222,13 +211,6 @@ bool CCamera::GetCameraInvertY()
|
||||||
return m_cameraInvertY;
|
return m_cameraInvertY;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCamera::GetMotorTurn()
|
|
||||||
{
|
|
||||||
if (m_type == CAM_TYPE_BACK)
|
|
||||||
return m_motorTurn;
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCamera::Init(Math::Vector eye, Math::Vector lookat, float delay)
|
void CCamera::Init(Math::Vector eye, Math::Vector lookat, float delay)
|
||||||
{
|
{
|
||||||
m_initDelay = delay;
|
m_initDelay = delay;
|
||||||
|
@ -1076,6 +1058,11 @@ bool CCamera::EventProcess(const Event &event)
|
||||||
EventFrame(event);
|
EventFrame(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVENT_MOUSE_BUTTON_DOWN:
|
||||||
|
case EVENT_MOUSE_BUTTON_UP:
|
||||||
|
EventMouseButton(event);
|
||||||
|
break;
|
||||||
|
|
||||||
case EVENT_MOUSE_MOVE:
|
case EVENT_MOUSE_MOVE:
|
||||||
EventMouseMove(event);
|
EventMouseMove(event);
|
||||||
break;
|
break;
|
||||||
|
@ -1092,7 +1079,10 @@ bool CCamera::EventProcess(const Event &event)
|
||||||
|
|
||||||
bool CCamera::EventMouseMove(const Event &event)
|
bool CCamera::EventMouseMove(const Event &event)
|
||||||
{
|
{
|
||||||
|
m_mouseDelta += (event.mousePos - m_mousePos);
|
||||||
m_mousePos = event.mousePos;
|
m_mousePos = event.mousePos;
|
||||||
|
if (m_mouseRightDown)
|
||||||
|
m_engine->SetMouseType(ENG_MOUSE_MOVE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1129,6 +1119,24 @@ void CCamera::EventMouseWheel(const Event &event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCamera::EventMouseButton(const Event &event)
|
||||||
|
{
|
||||||
|
if (event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_RIGHT)
|
||||||
|
{
|
||||||
|
if (event.type == EVENT_MOUSE_BUTTON_DOWN)
|
||||||
|
{
|
||||||
|
m_mouseRightDown = true;
|
||||||
|
m_mouseDelta.LoadZero();
|
||||||
|
m_engine->SetMouseType(ENG_MOUSE_MOVE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_mouseRightDown = false;
|
||||||
|
m_engine->SetMouseType(ENG_MOUSE_NORM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CCamera::EventFrame(const Event &event)
|
bool CCamera::EventFrame(const Event &event)
|
||||||
{
|
{
|
||||||
EffectFrame(event);
|
EffectFrame(event);
|
||||||
|
@ -1168,69 +1176,6 @@ bool CCamera::EventFrame(const Event &event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EngineMouseType CCamera::GetMouseDef(Math::Point pos)
|
|
||||||
{
|
|
||||||
EngineMouseType type = ENG_MOUSE_NORM;
|
|
||||||
m_mousePos = pos;
|
|
||||||
|
|
||||||
if (m_type == CAM_TYPE_INFO)
|
|
||||||
return type;
|
|
||||||
|
|
||||||
if (m_rightDown) // the right button pressed?
|
|
||||||
{
|
|
||||||
m_rightPosMove.x = pos.x - m_rightPosCenter.x;
|
|
||||||
m_rightPosMove.y = pos.y - m_rightPosCenter.y;
|
|
||||||
type = ENG_MOUSE_MOVE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!m_cameraScroll)
|
|
||||||
return type;
|
|
||||||
|
|
||||||
m_mouseDirH = 0.0f;
|
|
||||||
m_mouseDirV = 0.0f;
|
|
||||||
|
|
||||||
if (pos.x < m_mouseMarging)
|
|
||||||
m_mouseDirH = pos.x / m_mouseMarging - 1.0f;
|
|
||||||
|
|
||||||
if (pos.x > 1.0f - m_mouseMarging)
|
|
||||||
m_mouseDirH = 1.0f - (1.0f - pos.x) / m_mouseMarging;
|
|
||||||
|
|
||||||
if (pos.y < m_mouseMarging)
|
|
||||||
m_mouseDirV = pos.y / m_mouseMarging - 1.0f;
|
|
||||||
|
|
||||||
if (pos.y > 1.0f-m_mouseMarging)
|
|
||||||
m_mouseDirV = 1.0f - (1.0f - pos.y) / m_mouseMarging;
|
|
||||||
|
|
||||||
if ( m_type == CAM_TYPE_FREE ||
|
|
||||||
m_type == CAM_TYPE_EDIT ||
|
|
||||||
m_type == CAM_TYPE_BACK ||
|
|
||||||
m_type == CAM_TYPE_FIX ||
|
|
||||||
m_type == CAM_TYPE_PLANE ||
|
|
||||||
m_type == CAM_TYPE_EXPLO )
|
|
||||||
{
|
|
||||||
if (m_mouseDirH > 0.0f)
|
|
||||||
type = ENG_MOUSE_SCROLLR;
|
|
||||||
if (m_mouseDirH < 0.0f)
|
|
||||||
type = ENG_MOUSE_SCROLLL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_type == CAM_TYPE_FREE ||
|
|
||||||
m_type == CAM_TYPE_EDIT )
|
|
||||||
{
|
|
||||||
if (m_mouseDirV > 0.0f)
|
|
||||||
type = ENG_MOUSE_SCROLLU;
|
|
||||||
if (m_mouseDirV < 0.0f)
|
|
||||||
type = ENG_MOUSE_SCROLLD;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_cameraInvertX)
|
|
||||||
m_mouseDirH = -m_mouseDirH;
|
|
||||||
}
|
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCamera::EventFrameFree(const Event &event)
|
bool CCamera::EventFrameFree(const Event &event)
|
||||||
{
|
{
|
||||||
Math::Vector cameraInput = event.cameraInput;
|
Math::Vector cameraInput = event.cameraInput;
|
||||||
|
@ -1241,10 +1186,12 @@ bool CCamera::EventFrameFree(const Event &event)
|
||||||
|
|
||||||
float factor = m_heightEye * 0.5f + 30.0f;
|
float factor = m_heightEye * 0.5f + 30.0f;
|
||||||
|
|
||||||
if ( m_mouseDirH != 0.0f )
|
if ( m_mouseRightDown )
|
||||||
m_directionH -= m_mouseDirH * event.rTime * 0.7f * m_speed;
|
{
|
||||||
if ( m_mouseDirV != 0.0f )
|
m_directionH -= m_mouseDelta.x * 2*Math::PI;
|
||||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDirV * event.rTime * factor * m_speed);
|
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDelta.y * factor * m_speed);
|
||||||
|
m_mouseDelta.LoadZero();
|
||||||
|
}
|
||||||
|
|
||||||
// Up/Down
|
// Up/Down
|
||||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, cameraInput.y * event.rTime * factor * m_speed);
|
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, cameraInput.y * event.rTime * factor * m_speed);
|
||||||
|
@ -1314,17 +1261,13 @@ bool CCamera::EventFrameEdit(const Event &event)
|
||||||
{
|
{
|
||||||
float factor = m_editHeight * 0.5f + 30.0f;
|
float factor = m_editHeight * 0.5f + 30.0f;
|
||||||
|
|
||||||
if (m_mouseDirH != 0.0f)
|
if (m_mouseRightDown)
|
||||||
m_directionH -= m_mouseDirH * event.rTime * 0.7f * m_speed;
|
|
||||||
if (m_mouseDirV != 0.0f)
|
|
||||||
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDirV * event.rTime * factor * m_speed);
|
|
||||||
|
|
||||||
if (m_cameraScroll)
|
|
||||||
{
|
{
|
||||||
// Left/Right.
|
m_directionH -= m_mouseDelta.x * 2*Math::PI;
|
||||||
m_fixDirectionH += m_mouseDirH * event.rTime * 1.0f * m_speed;
|
m_eyePt = Math::LookatPoint(m_eyePt, m_directionH, m_directionV, m_mouseDelta.y * factor * m_speed);
|
||||||
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
|
m_mouseDelta.LoadZero();
|
||||||
}
|
}
|
||||||
|
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
|
||||||
|
|
||||||
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
|
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
|
||||||
|
|
||||||
|
@ -1377,25 +1320,13 @@ bool CCamera::EventFrameBack(const Event &event)
|
||||||
if (m_backDist > 200.0f) m_backDist = 200.0f;
|
if (m_backDist > 200.0f) m_backDist = 200.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_motorTurn = 0.0f;
|
if (m_mouseRightDown)
|
||||||
|
|
||||||
if (m_rightDown)
|
|
||||||
{
|
{
|
||||||
m_addDirectionH = m_rightPosMove.x * 6.0f;
|
m_addDirectionH -= m_mouseDelta.x * 2*Math::PI;
|
||||||
m_addDirectionV = -m_rightPosMove.y * 2.0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (m_cameraScroll)
|
|
||||||
{
|
|
||||||
// Left/Right
|
|
||||||
m_addDirectionH += m_mouseDirH * event.rTime * 1.0f * m_speed;
|
|
||||||
m_addDirectionH = Math::NormAngle(m_addDirectionH);
|
m_addDirectionH = Math::NormAngle(m_addDirectionH);
|
||||||
}
|
m_mouseDelta.LoadZero();
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_mouseDirH != 0) || (m_mouseDirV != 0))
|
|
||||||
AbortCentering(); // special stops framing
|
AbortCentering(); // special stops framing
|
||||||
|
}
|
||||||
|
|
||||||
// Increase the special framework
|
// Increase the special framework
|
||||||
float centeringH = 0.0f;
|
float centeringH = 0.0f;
|
||||||
|
@ -1528,21 +1459,21 @@ bool CCamera::EventFrameFix(const Event &event)
|
||||||
if (m_fixDist > 200.0f) m_fixDist = 200.0f;
|
if (m_fixDist > 200.0f) m_fixDist = 200.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Left/Right
|
if (m_mouseRightDown)
|
||||||
if (m_cameraScroll)
|
|
||||||
{
|
{
|
||||||
m_fixDirectionH += m_mouseDirH * event.rTime * 1.0f * m_speed;
|
m_fixDirectionH -= m_mouseDelta.x * 2*Math::PI;
|
||||||
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
|
m_mouseDelta.LoadZero();
|
||||||
|
AbortCentering(); // special stops framing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Left/Right
|
||||||
m_fixDirectionH += event.cameraInput.x * event.rTime * 0.7f * m_speed;
|
m_fixDirectionH += event.cameraInput.x * event.rTime * 0.7f * m_speed;
|
||||||
|
m_fixDirectionH = Math::NormAngle(m_fixDirectionH);
|
||||||
|
|
||||||
// Up/Down
|
// Up/Down
|
||||||
m_fixDirectionV -= event.cameraInput.y * event.rTime * 0.7f * m_speed;
|
m_fixDirectionV -= event.cameraInput.y * event.rTime * 0.7f * m_speed;
|
||||||
m_fixDirectionV = Math::Min(Math::Max(m_fixDirectionV, -0.5*Math::PI), 0.25*Math::PI);
|
m_fixDirectionV = Math::Min(Math::Max(m_fixDirectionV, -0.5*Math::PI), 0.25*Math::PI);
|
||||||
|
|
||||||
if ((m_mouseDirH != 0) || (m_mouseDirV != 0))
|
|
||||||
AbortCentering(); // special stops framing
|
|
||||||
|
|
||||||
if (m_cameraObj != nullptr)
|
if (m_cameraObj != nullptr)
|
||||||
{
|
{
|
||||||
Math::Vector lookatPt = m_cameraObj->GetPosition();
|
Math::Vector lookatPt = m_cameraObj->GetPosition();
|
||||||
|
@ -1567,8 +1498,11 @@ bool CCamera::EventFrameFix(const Event &event)
|
||||||
|
|
||||||
bool CCamera::EventFrameExplo(const Event &event)
|
bool CCamera::EventFrameExplo(const Event &event)
|
||||||
{
|
{
|
||||||
if (m_mouseDirH != 0.0f)
|
if (m_mouseRightDown)
|
||||||
m_directionH -= m_mouseDirH * event.rTime * 0.7f * m_speed;
|
{
|
||||||
|
m_directionH -= m_mouseDelta.x * 2*Math::PI;
|
||||||
|
m_mouseDelta.LoadZero();
|
||||||
|
}
|
||||||
|
|
||||||
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
|
m_terrain->AdjustToBounds(m_eyePt, 10.0f);
|
||||||
|
|
||||||
|
@ -1649,9 +1583,10 @@ bool CCamera::EventFrameVisit(const Event &event)
|
||||||
if (m_visitDirectionV > 0.0f ) m_visitDirectionV = 0.0f;
|
if (m_visitDirectionV > 0.0f ) m_visitDirectionV = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cameraScroll)
|
if (m_mouseRightDown)
|
||||||
{
|
{
|
||||||
m_visitDist -= m_mouseDirV * event.rTime * 30.0f * m_speed;
|
m_visitDist -= m_mouseDelta.y * 100.0f * m_speed;
|
||||||
|
m_mouseDelta.LoadZero();
|
||||||
if (m_visitDist < 20.0f) m_visitDist = 20.0f;
|
if (m_visitDist < 20.0f) m_visitDist = 20.0f;
|
||||||
if (m_visitDist > 200.0f) m_visitDist = 200.0f;
|
if (m_visitDist > 200.0f) m_visitDist = 200.0f;
|
||||||
}
|
}
|
||||||
|
@ -1744,5 +1679,4 @@ void CCamera::SetCameraSpeed(float speed)
|
||||||
m_speed = speed;
|
m_speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,18 +211,15 @@ public:
|
||||||
void SetCameraInvertY(bool invert);
|
void SetCameraInvertY(bool invert);
|
||||||
bool GetCameraInvertY();
|
bool GetCameraInvertY();
|
||||||
|
|
||||||
//! Returns an additional force to turn
|
|
||||||
float GetMotorTurn();
|
|
||||||
//! Returns the default sprite to use for the mouse
|
|
||||||
EngineMouseType GetMouseDef(Math::Point pos);
|
|
||||||
|
|
||||||
void SetCameraSpeed(float speed);
|
void SetCameraSpeed(float speed);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Changes the camera according to the mouse moved
|
//! Changes the camera according to the mouse moved
|
||||||
bool EventMouseMove(const Event &event);
|
bool EventMouseMove(const Event &event);
|
||||||
//! Mouse wheel operation
|
//! Mouse wheel operation
|
||||||
void EventMouseWheel(const Event& event);
|
void EventMouseWheel(const Event &event);
|
||||||
|
//! Mouse button handling
|
||||||
|
void EventMouseButton(const Event &event);
|
||||||
//! Changes the camera according to the time elapsed
|
//! Changes the camera according to the time elapsed
|
||||||
bool EventFrame(const Event &event);
|
bool EventFrame(const Event &event);
|
||||||
//! Moves the point of view
|
//! Moves the point of view
|
||||||
|
@ -301,11 +298,6 @@ protected:
|
||||||
|
|
||||||
float m_focus;
|
float m_focus;
|
||||||
|
|
||||||
bool m_rightDown;
|
|
||||||
Math::Point m_rightPosInit;
|
|
||||||
Math::Point m_rightPosCenter;
|
|
||||||
Math::Point m_rightPosMove;
|
|
||||||
|
|
||||||
//! CAM_TYPE_FREE: eye
|
//! CAM_TYPE_FREE: eye
|
||||||
Math::Vector m_eyePt;
|
Math::Vector m_eyePt;
|
||||||
//! CAM_TYPE_FREE: horizontal direction
|
//! CAM_TYPE_FREE: horizontal direction
|
||||||
|
@ -352,12 +344,9 @@ protected:
|
||||||
|
|
||||||
float m_remotePan;
|
float m_remotePan;
|
||||||
|
|
||||||
Math::Point m_mousePos;
|
bool m_mouseRightDown = false;
|
||||||
float m_mouseDirH;
|
Math::Point m_mousePos = Math::Point(0.5f, 0.5f);
|
||||||
float m_mouseDirV;
|
Math::Point m_mouseDelta = Math::Point(0.0f, 0.0f);
|
||||||
float m_mouseMarging;
|
|
||||||
|
|
||||||
float m_motorTurn;
|
|
||||||
|
|
||||||
CenteringPhase m_centeringPhase;
|
CenteringPhase m_centeringPhase;
|
||||||
float m_centeringAngleH;
|
float m_centeringAngleH;
|
||||||
|
@ -396,7 +385,6 @@ protected:
|
||||||
bool m_cameraInvertX;
|
bool m_cameraInvertX;
|
||||||
//! Y inversion in the edges?
|
//! Y inversion in the edges?
|
||||||
bool m_cameraInvertY;
|
bool m_cameraInvertY;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -687,7 +687,6 @@ bool CRobotMain::ProcessEvent(Event &event)
|
||||||
m_displayText->EventProcess(event);
|
m_displayText->EventProcess(event);
|
||||||
RemoteCamera(m_cameraPan, m_cameraZoom, event.rTime);
|
RemoteCamera(m_cameraPan, m_cameraZoom, event.rTime);
|
||||||
|
|
||||||
m_interface->EventProcess(event);
|
|
||||||
if (m_displayInfo != nullptr) // current edition?
|
if (m_displayInfo != nullptr) // current edition?
|
||||||
m_displayInfo->EventProcess(event);
|
m_displayInfo->EventProcess(event);
|
||||||
|
|
||||||
|
|
|
@ -2103,7 +2103,6 @@ bool COldObject::EventProcess(const Event &event)
|
||||||
axeZ = -1.0f; // tomb
|
axeZ = -1.0f; // tomb
|
||||||
}
|
}
|
||||||
|
|
||||||
axeX += m_camera->GetMotorTurn(); // additional power according to camera
|
|
||||||
if ( axeX > 1.0f ) axeX = 1.0f;
|
if ( axeX > 1.0f ) axeX = 1.0f;
|
||||||
if ( axeX < -1.0f ) axeX = -1.0f;
|
if ( axeX < -1.0f ) axeX = -1.0f;
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ bool CControl::EventProcess(const Event &event)
|
||||||
GlintFrame(event);
|
GlintFrame(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event.type == EVENT_MOUSE_MOVE )
|
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||||
{
|
{
|
||||||
m_glintMouse = event.mousePos;
|
m_glintMouse = event.mousePos;
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ bool CEdit::EventProcess(const Event &event)
|
||||||
m_timeBlink += event.rTime;
|
m_timeBlink += event.rTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event.type == EVENT_MOUSE_MOVE )
|
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||||
{
|
{
|
||||||
if ( Detect(event.mousePos) &&
|
if ( Detect(event.mousePos) &&
|
||||||
event.mousePos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
|
event.mousePos.x < m_pos.x+m_dim.x-(m_bMulti?MARGX+SCROLL_WIDTH:0.0f) )
|
||||||
|
|
|
@ -54,7 +54,6 @@ CInterface::CInterface()
|
||||||
{
|
{
|
||||||
m_event = CApplication::GetInstancePointer()->GetEventQueue();
|
m_event = CApplication::GetInstancePointer()->GetEventQueue();
|
||||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||||
m_camera = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Object's destructor.
|
// Object's destructor.
|
||||||
|
@ -300,12 +299,9 @@ CControl* CInterface::SearchControl(EventType eventMsg)
|
||||||
|
|
||||||
bool CInterface::EventProcess(const Event &event)
|
bool CInterface::EventProcess(const Event &event)
|
||||||
{
|
{
|
||||||
if (event.type == EVENT_MOUSE_MOVE)
|
if (event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP)
|
||||||
{
|
{
|
||||||
if (m_camera == nullptr)
|
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
||||||
m_camera = CRobotMain::GetInstancePointer()->GetCamera();
|
|
||||||
|
|
||||||
m_engine->SetMouseType(m_camera->GetMouseDef(event.mousePos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& control : boost::adaptors::reverse(m_controls))
|
for (auto& control : boost::adaptors::reverse(m_controls))
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
namespace Gfx
|
namespace Gfx
|
||||||
{
|
{
|
||||||
class CCamera;
|
|
||||||
class CEngine;
|
class CEngine;
|
||||||
} // namespace Gfx
|
} // namespace Gfx
|
||||||
|
|
||||||
|
@ -101,7 +100,6 @@ protected:
|
||||||
|
|
||||||
CEventQueue* m_event;
|
CEventQueue* m_event;
|
||||||
Gfx::CEngine* m_engine;
|
Gfx::CEngine* m_engine;
|
||||||
Gfx::CCamera* m_camera;
|
|
||||||
std::array<std::unique_ptr<CControl>, MAXCONTROL> m_controls;
|
std::array<std::unique_ptr<CControl>, MAXCONTROL> m_controls;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,9 @@ bool CList::EventProcess(const Event &event)
|
||||||
|
|
||||||
CControl::EventProcess(event);
|
CControl::EventProcess(event);
|
||||||
|
|
||||||
if (event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos))
|
if (event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP)
|
||||||
|
{
|
||||||
|
if (Detect(event.mousePos))
|
||||||
{
|
{
|
||||||
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
||||||
for (int i = 0; i < m_displayLine; i++)
|
for (int i = 0; i < m_displayLine; i++)
|
||||||
|
@ -304,6 +306,7 @@ bool CList::EventProcess(const Event &event)
|
||||||
m_buttons[i]->EventProcess(event);
|
m_buttons[i]->EventProcess(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_bSelectCap)
|
if (m_bSelectCap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -203,13 +203,16 @@ bool CMap::EventProcess(const Event &event)
|
||||||
if ( event.type == EVENT_FRAME )
|
if ( event.type == EVENT_FRAME )
|
||||||
m_time += event.rTime;
|
m_time += event.rTime;
|
||||||
|
|
||||||
if ( event.type == EVENT_MOUSE_MOVE && Detect(event.mousePos) )
|
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||||
|
{
|
||||||
|
if (Detect(event.mousePos))
|
||||||
{
|
{
|
||||||
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
|
||||||
bool inMap = false;
|
bool inMap = false;
|
||||||
if (DetectObject(event.mousePos, inMap) != nullptr)
|
if (DetectObject(event.mousePos, inMap) != nullptr)
|
||||||
m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
|
m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (event.type == EVENT_MOUSE_BUTTON_DOWN &&
|
if (event.type == EVENT_MOUSE_BUTTON_DOWN &&
|
||||||
event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_LEFT)
|
event.GetData<MouseButtonEventData>()->button == MOUSE_BUTTON_LEFT)
|
||||||
|
|
|
@ -64,7 +64,7 @@ bool CTarget::EventProcess(const Event &event)
|
||||||
|
|
||||||
CControl::EventProcess(event);
|
CControl::EventProcess(event);
|
||||||
|
|
||||||
if ( event.type == EVENT_MOUSE_MOVE )
|
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||||
{
|
{
|
||||||
m_main->SetFriendAim(false);
|
m_main->SetFriendAim(false);
|
||||||
|
|
||||||
|
|
|
@ -662,7 +662,7 @@ int CWindow::BorderDetect(Math::Point pos)
|
||||||
|
|
||||||
bool CWindow::EventProcess(const Event &event)
|
bool CWindow::EventProcess(const Event &event)
|
||||||
{
|
{
|
||||||
if ( event.type == EVENT_MOUSE_MOVE )
|
if ( event.type == EVENT_MOUSE_MOVE || event.type == EVENT_MOUSE_BUTTON_DOWN || event.type == EVENT_MOUSE_BUTTON_UP )
|
||||||
{
|
{
|
||||||
if ( m_bCapture )
|
if ( m_bCapture )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue