Add a buttonMode to grid view to enable it on pointerless devices.

This commit is contained in:
Tobias Loose
2013-12-08 09:11:44 +01:00
parent bdd0e6c042
commit 12c5f31562
7 changed files with 156 additions and 44 deletions
+37
View File
@@ -118,6 +118,31 @@ void CarouselDeckView::Render()
}
}
bool CarouselDeckView::ButtonPressed(Buttons button)
{
switch(button)
{
case JGE_BTN_LEFT:
changePosition(-1);
last_user_activity = 0;
break;
case JGE_BTN_RIGHT:
changePosition(1);
last_user_activity = 0;
break;
case JGE_BTN_UP:
changeFilter(1);
last_user_activity = 0;
break;
case JGE_BTN_DOWN:
changeFilter(-1);
last_user_activity = 0;
break;
default:
return false;
}
return true;
}
MTGCard * CarouselDeckView::Click(int x, int y)
{
int n = getCardIndexNextTo(x, y);
@@ -139,6 +164,18 @@ MTGCard * CarouselDeckView::Click(int x, int y)
return NULL;
}
MTGCard *CarouselDeckView::Click()
{
if(mSlideEasing.finished() && mScrollEasing.finished())
{
return getActiveCard();
}
else
{
return NULL;
}
}
void CarouselDeckView::changePosition(int offset)
{
mScrollEasing.start((float)offset, (float)(0.3f*abs(offset)));