Skip to content

Commit

Permalink
CAVEEXPRESS: improvements #73
Browse files Browse the repository at this point in the history
map finished window should always have the continue button as focus
  • Loading branch information
mgerhardy committed Jan 14, 2016
1 parent fdcedaa commit ce44328
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/modules/ui/windows/UIMapFinishedWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,24 @@ UIMapFinishedWindow::UIMapFinishedWindow (IFrontend *frontend, CampaignManager&

const float gapBack = std::max(0.01f, getScreenPadding());

UINodeMainButton *continueCampaign = new UINodeMainButton(frontend, tr("Continue"));
continueCampaign->alignTo(background, NODE_ALIGN_BOTTOM | NODE_ALIGN_RIGHT, gapBack);
continueCampaign->addListener(UINodeListenerPtr(new ContinuePlayNodeListener(campaignManager, serviceProvider)));
add(continueCampaign);

_replayCampaign = new UINodeMainButton(frontend, tr("Retry"));
_replayCampaign->alignTo(background, NODE_ALIGN_BOTTOM | NODE_ALIGN_CENTER, gapBack);
_replayCampaign->addListener(UINodeListenerPtr(new ReplayNodeListener(campaignManager)));
add(_replayCampaign);

UINodePoint *points = new UINodePoint(frontend);
points->setFont(LARGE_FONT);
points->setId(UINODE_FINISHEDPOINTS);
points->alignTo(background, NODE_ALIGN_CENTER | NODE_ALIGN_MIDDLE, 0.1f);
add(points);

if (!wantBackButton())
return;
if (wantBackButton())
add(new UINodeBackButton(frontend, background));

_replayCampaign = new UINodeMainButton(frontend, tr("Retry"));
_replayCampaign->alignTo(background, NODE_ALIGN_BOTTOM | NODE_ALIGN_CENTER, gapBack);
_replayCampaign->addListener(UINodeListenerPtr(new ReplayNodeListener(campaignManager)));
add(_replayCampaign);

add(new UINodeBackButton(frontend, background));
UINodeMainButton *continueCampaign = new UINodeMainButton(frontend, tr("Continue"));
continueCampaign->alignTo(background, NODE_ALIGN_BOTTOM | NODE_ALIGN_RIGHT, gapBack);
continueCampaign->addListener(UINodeListenerPtr(new ContinuePlayNodeListener(campaignManager, serviceProvider)));
add(continueCampaign);
}

bool UIMapFinishedWindow::onPush ()
Expand All @@ -66,3 +64,9 @@ bool UIMapFinishedWindow::onPush ()
}
return UIWindow::onPush();
}

void UIMapFinishedWindow::onActive ()
{
UIWindow::onActive();
addLastFocus();
}
1 change: 1 addition & 0 deletions src/modules/ui/windows/UIMapFinishedWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ class UIMapFinishedWindow: public UIWindow {
public:
UIMapFinishedWindow (IFrontend *frontend, CampaignManager& campaignManager, ServiceProvider& serviceProvider, const SoundType& soundType);
bool onPush () override;
void onActive () override;
};

0 comments on commit ce44328

Please sign in to comment.