Skip to content

Commit

Permalink
Replace menu Debug checkbox with Debug shortcut.
Browse files Browse the repository at this point in the history
(press D on menu to get debug options)
  • Loading branch information
SupSuper committed Mar 17, 2019
1 parent a0de971 commit e351651
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 129 deletions.
6 changes: 0 additions & 6 deletions data/forms/mainmenu.form
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
<alignment horizontal="centre" vertical="centre"/>
<font>bigfont</font>
</label>
<label text="Debug Mode">
<position x="410" y="bottom"/>
<size width="200" height="16"/>
<alignment horizontal="right" vertical="centre"/>
<font>smallset</font>
</label>
<label text="Version" id="VERSION_LABEL">
<position x="0" y="0"/>
<size width="640" height="16"/>
Expand Down
5 changes: 3 additions & 2 deletions forms/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,9 @@ void Control::eventOccured(Event *e)
}
fw().renderer->draw(textImage, {totalBorder, totalBorder});

fw().showToolTip(surface, pos + resolvedLocation -
Vec2<int>{surface->size.x / 2, surface->size.y});
fw().showToolTip(surface,
pos + resolvedLocation -
Vec2<int>{surface->size.x / 2, surface->size.y});
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions game/ui/base/vequipscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ VEquipScreen::VEquipScreen(sp<GameState> state)
this->selected->name =
std::dynamic_pointer_cast<TextEdit>(e->forms().RaisedBy)->getText();
}
});
});
form->findControlTyped<TextEdit>("TEXT_VEHICLE_NAME")
->addCallback(FormEventType::TextEditCancel, [this](FormsEvent *e) {
if (this->selected)
{
std::dynamic_pointer_cast<TextEdit>(e->forms().RaisedBy)
->setText(this->selected->name);
}
});
});

this->paperDoll->setNonHighlightColour(EQUIP_GRID_COLOUR);
this->setHighlightedSlotType(EquipmentSlotType::VehicleWeapon);
Expand Down
9 changes: 9 additions & 0 deletions game/ui/general/mainmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ MainMenu::MainMenu() : Stage(), mainmenuform(ui().getForm("mainmenu"))
{
auto versionLabel = mainmenuform->findControlTyped<Label>("VERSION_LABEL");
versionLabel->setText(OPENAPOC_VERSION);
#ifndef NDEBUG
auto debugButton = mainmenuform->findControlTyped<Control>("BUTTON_DEBUG");
debugButton->setVisible(true);
#endif
}

MainMenu::~MainMenu() = default;
Expand All @@ -46,6 +50,11 @@ void MainMenu::eventOccurred(Event *e)
fw().stageQueueCommand({StageCmd::Command::QUIT});
return;
}
if (e->keyboard().KeyCode == SDLK_d)
{
fw().stageQueueCommand({StageCmd::Command::PUSH, mksp<DebugMenu>()});
return;
}
}

if (e->type() == EVENT_FORM_INTERACTION && e->forms().EventFlag == FormEventType::ButtonClick)
Expand Down
Loading

0 comments on commit e351651

Please sign in to comment.