Fixed a selection problem sometimes hapenning on the hand zone in touch/mouse mode and removed dead code.

This commit is contained in:
Xawotihs
2011-07-14 21:21:24 +00:00
parent 9f80620f0a
commit c2879b0b6e
2 changed files with 61 additions and 118 deletions

View File

@@ -32,7 +32,6 @@ public:
virtual void Add(PlayGuiObject*) = 0;
virtual void Remove(PlayGuiObject*) = 0;
virtual bool CheckUserInput(JButton key) = 0;
virtual bool CheckUserInput(int x, int y) = 0;
virtual void PushLimitor() = 0;
virtual void PopLimitor() = 0;
virtual void Limit(LimitorFunctor<PlayGuiObject>* inLimitor, CardView::SelectorZone inZone) = 0;
@@ -75,7 +74,6 @@ public:
void Add(PlayGuiObject*);
void Remove(PlayGuiObject*);
bool CheckUserInput(JButton key);
bool CheckUserInput(int x, int y);
void Update(float dt);
void Render();
void Push();

View File

@@ -226,6 +226,8 @@ bool CardSelector::CheckUserInput(JButton key)
}
}
}
if(key != JGE_BTN_NONE)
{
if (active != oldactive)
{
CardView::SelectorZone oldowner, owner;
@@ -286,63 +288,6 @@ bool CardSelector::CheckUserInput(JButton key)
}
}
}
if (active != oldactive)
{
{
CardView* c = dynamic_cast<CardView*> (oldactive);
if (c)
c->zoom = 1.0f;
}
{
CardView* c = dynamic_cast<CardView*> (active);
if (c)
c->zoom = 1.4f;
}
if (oldactive)
oldactive->Leaving(JGE_BTN_NONE);
if (active)
active->Entering();
}
return true;
}
bool CardSelector::CheckUserInput(int x, int y)
{
if (!active)
{
for (vector<Target*>::iterator it = cards.begin(); it != cards.end(); ++it)
if ((NULL == limitor) || (limitor->select(*it)))
{
active = *it;
active->Entering();
return true;
}
return true;
}
Target* oldactive = active;
active = closest<True> (cards, limitor, static_cast<float> (x), static_cast<float> (y));
if (active != oldactive)
{
CardView::SelectorZone oldowner, owner;
if (CardView *q = dynamic_cast<CardView*>(oldactive))
oldowner = q->owner;
else
oldowner = CardView::nullZone;
if (CardView *q = dynamic_cast<CardView*>(active))
owner = q->owner;
else
owner = CardView::nullZone;
if (oldowner != owner)
{
if (CardView::nullZone != owner)
{
if (PlayGuiObject* old = fetchMemory(lasts[owner]))
if (old)
active = old;
}
lasts[oldowner] = SelectorMemory(oldactive);
}
}
if (active != oldactive)
{