Touch events are now handled before key events

This commit is contained in:
Xawotihs
2011-08-07 19:48:01 +00:00
parent 765b6b0412
commit 4dd8eaadad
+13 -8
View File
@@ -185,14 +185,22 @@ bool CardSelector::CheckUserInput(JButton key)
return true; return true;
} }
Target* oldactive = active; Target* oldactive = active;
int x,y;
if(JGE::GetInstance()->GetLeftClickCoordinates(x, y))
{
active = closest<True> (cards, limitor, static_cast<float> (x), static_cast<float> (y));
}
switch (key) switch (key)
{ {
case JGE_BTN_SEC: case JGE_BTN_SEC:
GameObserver::GetInstance()->cancelCurrentAction(); GameObserver::GetInstance()->cancelCurrentAction();
return true; goto switch_active;
break;
case JGE_BTN_OK: case JGE_BTN_OK:
GameObserver::GetInstance()->ButtonPressed(active); GameObserver::GetInstance()->ButtonPressed(active);
return true; goto switch_active;
break; break;
case JGE_BTN_LEFT: case JGE_BTN_LEFT:
active = closest<Left> (cards, limitor, active); active = closest<Left> (cards, limitor, active);
@@ -215,12 +223,7 @@ bool CardSelector::CheckUserInput(JButton key)
return true; return true;
default: default:
{ {
int x,y; if(!JGE::GetInstance()->GetLeftClickCoordinates(x, y))
if(JGE::GetInstance()->GetLeftClickCoordinates(x, y))
{
active = closest<True> (cards, limitor, static_cast<float> (x), static_cast<float> (y));
}
else
{ {
return false; return false;
} }
@@ -289,6 +292,8 @@ bool CardSelector::CheckUserInput(JButton key)
} }
} }
} }
switch_active:
if (active != oldactive) if (active != oldactive)
{ {
{ {