1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-28 07:45:49 +00:00

Show refresh rate in resolution selector

This commit is contained in:
fgenesis 2015-07-12 20:25:46 +02:00
parent e285c26e05
commit 21545e1a24
5 changed files with 17 additions and 10 deletions

View file

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SCROLL_DELAY 0.1f
#define SCROLL_DELAY_FIRST 0.4f
AquariaComboBox::AquariaComboBox() : RenderObject()
AquariaComboBox::AquariaComboBox(Vector textscale) : RenderObject()
{
//Quad *bar, *window, *scrollBtnUp, *scrollBtnDown, *scrollBar;
bar = new Quad("gui/combo-drop", Vector(0,0));
@ -47,6 +47,7 @@ AquariaComboBox::AquariaComboBox() : RenderObject()
selectedItemLabel->setFontSize(8);
selectedItemLabel->offset.y = -10;
selectedItemLabel->position.x = -50;
selectedItemLabel->scale = textscale;
addChild(selectedItemLabel, PM_POINTER);
numDrops = 8;
@ -62,6 +63,8 @@ AquariaComboBox::AquariaComboBox() : RenderObject()
scrollDelay = 0;
firstScroll = 0;
this->textscale = textscale;
}
void AquariaComboBox::destroy()
@ -230,7 +233,7 @@ void AquariaComboBox::open(float t)
{
if (i < items.size())
{
AquariaComboBoxItem *a = new AquariaComboBoxItem(items[i], i, this);
AquariaComboBoxItem *a = new AquariaComboBoxItem(items[i], i, this, textscale);
a->alpha = 0;
a->alpha.interpolateTo(1, t);
a->position.y = (a->getHeight()+2) * ((i-scroll)+1);
@ -335,7 +338,7 @@ int AquariaComboBox::addItem(const std::string &n)
Vector unselectedColor(0.7, 0.7, 0.7);
Vector selectedColor(1,1,1);
AquariaComboBoxItem::AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo) : Quad()
AquariaComboBoxItem::AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo, Vector textscale) : Quad()
{
this->combo = combo;
index = idx;
@ -348,6 +351,7 @@ AquariaComboBoxItem::AquariaComboBoxItem(const std::string &str, int idx, Aquari
label->setText(str);
label->offset.y = -10;
label->position.x = -50;
label->scale = textscale;
addChild(label, PM_POINTER);
color = unselectedColor;

View file

@ -195,7 +195,7 @@ class AquariaComboBox;
class AquariaComboBoxItem : public Quad
{
public:
AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo);
AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo, Vector textscale);
protected:
void onUpdate(float dt);
@ -210,7 +210,7 @@ protected:
class AquariaComboBox : public RenderObject
{
public:
AquariaComboBox();
AquariaComboBox(Vector textscale = Vector(1, 1));
void destroy();
@ -242,6 +242,7 @@ protected:
int selectedItem;
float scrollDelay;
bool firstScroll;
Vector textscale;
std::vector<AquariaComboBoxItem*> shownItems;
};

View file

@ -3382,12 +3382,14 @@ void Game::createInGameMenu()
resolutionLabel->position = Vector(160, 260);
options->addChild(resolutionLabel, PM_POINTER);
resBox = new AquariaComboBox();
resBox = new AquariaComboBox(Vector(0.7f, 1.0f));
resBox->position = Vector(196, 285);
for (i = 0; i < core->screenModes.size(); i++)
{
std::ostringstream os;
os << core->screenModes[i].x << "x" << core->screenModes[i].y;
if(core->screenModes[i].hz)
os << " (" << core->screenModes[i].hz << "hz)";
resBox->addItem(os.str());
if (core->screenModes[i].x == dsq->user.video.resx && core->screenModes[i].y == dsq->user.video.resy)
{

View file

@ -2138,7 +2138,7 @@ void Core::enumerateScreenModes()
SDL_GetDisplayMode(0, i, &mode);
if (mode.w && mode.h && (mode.w > mode.h))
{
screenModes.push_back(ScreenMode(i, mode.w, mode.h));
screenModes.push_back(ScreenMode(i, mode.w, mode.h, mode.refresh_rate));
}
}

View file

@ -70,10 +70,10 @@ enum TimeUpdateType
struct ScreenMode
{
ScreenMode() { idx = x = y = 0; }
ScreenMode(int i, int x, int y) : idx(i), x(x), y(y) {}
ScreenMode() { idx = x = y = hz = 0; }
ScreenMode(int i, int x, int y, int hz) : idx(i), x(x), y(y), hz(hz) {}
int idx, x, y;
int idx, x, y, hz;
};
struct CoreSettings