summaryrefslogtreecommitdiffstats
path: root/src/ui/scroll.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 00:38:17 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-22 00:38:17 +0200
commit0ff419560d5a567afaa0294968cc1f5b5e6b597b (patch)
tree03edeac0b7850348b9b910e0d39dd88a477afd75 /src/ui/scroll.cpp
parent15ff1d512b9e103396144bec1cd8004ecf4f7f9c (diff)
downloadcolobot-0ff419560d5a567afaa0294968cc1f5b5e6b597b.tar.gz
colobot-0ff419560d5a567afaa0294968cc1f5b5e6b597b.tar.bz2
colobot-0ff419560d5a567afaa0294968cc1f5b5e6b597b.zip
Event fixes & refactoring
- added new state tracking to Event - removed old fields from Event - fixed some issues with Events and fps counter
Diffstat (limited to 'src/ui/scroll.cpp')
-rw-r--r--src/ui/scroll.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp
index d3d0ed2..17f210e 100644
--- a/src/ui/scroll.cpp
+++ b/src/ui/scroll.cpp
@@ -234,21 +234,21 @@ bool CScroll::EventProcess(const Event &event)
hButton = m_buttonUp?m_dim.x/0.75f:0.0f;
if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
(m_state & STATE_VISIBLE) &&
(m_state & STATE_ENABLE) )
{
- if ( CControl::Detect(event.mouseButton.pos) )
+ if ( CControl::Detect(event.mousePos) )
{
pos.y = m_pos.y+hButton;
dim.y = m_dim.y-hButton*2.0f;
pos.y += dim.y*(1.0f-m_visibleRatio)*(1.0f-m_visibleValue);
dim.y *= m_visibleRatio;
- if ( event.mouseButton.pos.y < pos.y ||
- event.mouseButton.pos.y > pos.y+dim.y ) // click outside cabin?
+ if ( event.mousePos.y < pos.y ||
+ event.mousePos.y > pos.y+dim.y ) // click outside cabin?
{
h = (m_dim.y-hButton*2.0f)*(1.0f-m_visibleRatio);
- value = 1.0f-(event.mouseButton.pos.y-(m_pos.y+hButton+dim.y*0.5f))/h;
+ value = 1.0f-(event.mousePos.y-(m_pos.y+hButton+dim.y*0.5f))/h;
if ( value < 0.0f ) value = 0.0f;
if ( value > 1.0f ) value = 1.0f;
m_visibleValue = value;
@@ -259,7 +259,7 @@ bool CScroll::EventProcess(const Event &event)
m_event->AddEvent(newEvent);
}
m_bCapture = true;
- m_pressPos = event.mouseButton.pos;
+ m_pressPos = event.mousePos;
m_pressValue = m_visibleValue;
}
}
@@ -269,7 +269,7 @@ bool CScroll::EventProcess(const Event &event)
h = (m_dim.y-hButton*2.0f)*(1.0f-m_visibleRatio);
if ( h != 0 )
{
- value = m_pressValue - (event.mouseMove.pos.y-m_pressPos.y)/h;
+ value = m_pressValue - (event.mousePos.y-m_pressPos.y)/h;
if ( value < 0.0f ) value = 0.0f;
if ( value > 1.0f ) value = 1.0f;
@@ -286,7 +286,7 @@ bool CScroll::EventProcess(const Event &event)
}
if ( event.type == EVENT_MOUSE_BUTTON_UP &&
- event.mouseButton.button == 1 &&
+ event.mouseButton.button == MOUSE_BUTTON_LEFT &&
m_bCapture )
{
m_bCapture = false;
@@ -294,7 +294,7 @@ bool CScroll::EventProcess(const Event &event)
if (event.type == EVENT_MOUSE_WHEEL &&
event.mouseWheel.dir == WHEEL_UP &&
- Detect(event.mouseWheel.pos) &&
+ Detect(event.mousePos) &&
m_buttonUp != 0)
{
Event newEvent = event;
@@ -303,7 +303,7 @@ bool CScroll::EventProcess(const Event &event)
}
if (event.type == EVENT_MOUSE_WHEEL &&
event.mouseWheel.dir == WHEEL_DOWN &&
- Detect(event.mouseWheel.pos) &&
+ Detect(event.mousePos) &&
m_buttonDown != 0)
{
Event newEvent = event;