add missing file to non-VS projects

start to fill the HighScoresDialog with real data
This commit is contained in:
thrust26 2020-02-11 23:12:33 +01:00
parent 4b116b3aef
commit f77e9312de
4 changed files with 27 additions and 9 deletions

View File

@ -31,6 +31,7 @@
- variation bits (Centipede)
- player bits (Asteroids, Space Invaders)
- score swaps (Asteroids)
- one optional and named value extra per game (round, level...)
*/
#include <cmath>
@ -282,6 +283,15 @@ Int32 HighScoresManager::player(uInt16 addr, uInt32 numPlayers, bool zeroBased)
return player;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int32 HighScoresManager::numVariations() const
{
Properties props;
uInt16 vars = numVariations(properties(props));
return vars;;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int32 HighScoresManager::player() const
{

View File

@ -96,6 +96,7 @@ class HighScoresManager
const ScoreAddresses& scoreAddr) const;
// Retrieve current values (using game's properties)
Int32 numVariations() const;
Int32 player() const;
Int32 variation() const;
Int32 score() const;

View File

@ -22,6 +22,7 @@
//#include "StringParser.hxx"
#include "EditTextWidget.hxx"
#include "PopUpWidget.hxx"
#include "HighScoresManager.hxx"
#include "HighScoresDialog.hxx"
@ -32,16 +33,16 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
: Dialog(osystem, parent, font, "High Scores")
{
const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
buttonHeight = font.getLineHeight() + 4;
const int lineHeight = font.getLineHeight();
//fontWidth = font.getMaxCharWidth(),
//fontHeight = font.getFontHeight(),
//buttonHeight = font.getLineHeight() + 4;
//infoLineHeight = ifont.getLineHeight();
const int VBORDER = 8;
const int HBORDER = 10;
const int VGAP = 4;
int xpos, ypos, lwidth, fwidth, pwidth, tabID;
int xpos, ypos;
WidgetArray wid;
VariantList items;
@ -55,7 +56,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
StaticTextWidget* s = new StaticTextWidget(this, font, xpos, ypos + 1, "Variation ");
myVariation = new PopUpWidget(this, font, s->getRight(), ypos,
font.getStringWidth("256"), lineHeight, items, "", 0, 0);
font.getStringWidth("256") - 4, lineHeight, items, "", 0, 0);
ypos += lineHeight + VGAP * 2;
@ -116,10 +117,14 @@ void HighScoresDialog::loadConfig()
items.clear();
for (Int32 i = 1; i <= 10; ++i)
VarList::push_back(items, i, i);
for (Int32 i = 1; i <= instance().highScores().numVariations(); ++i)
{
ostringstream buf;
buf << std::setw(3) << std::setfill(' ') << i;
VarList::push_back(items, buf.str(), i);
}
myVariation->addItems(items);
myVariation->setSelected(instance().highScores().variation());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -21,6 +21,8 @@ MODULE_OBJS := \
src/gui/GameInfoDialog.o \
src/gui/GlobalPropsDialog.o \
src/gui/HelpDialog.o \
src/gui/HighScoresDialog.o \
src/gui/HighScoresMenu.o \
src/gui/InputDialog.o \
src/gui/InputTextDialog.o \
src/gui/JoystickDialog.o \