Add a buttonMode to grid view to enable it on pointerless devices.
This commit is contained in:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user