mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-29 00:05:50 +00:00
Show refresh rate in resolution selector
This commit is contained in:
parent
e285c26e05
commit
21545e1a24
5 changed files with 17 additions and 10 deletions
|
@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define SCROLL_DELAY 0.1f
|
#define SCROLL_DELAY 0.1f
|
||||||
#define SCROLL_DELAY_FIRST 0.4f
|
#define SCROLL_DELAY_FIRST 0.4f
|
||||||
|
|
||||||
AquariaComboBox::AquariaComboBox() : RenderObject()
|
AquariaComboBox::AquariaComboBox(Vector textscale) : RenderObject()
|
||||||
{
|
{
|
||||||
//Quad *bar, *window, *scrollBtnUp, *scrollBtnDown, *scrollBar;
|
//Quad *bar, *window, *scrollBtnUp, *scrollBtnDown, *scrollBar;
|
||||||
bar = new Quad("gui/combo-drop", Vector(0,0));
|
bar = new Quad("gui/combo-drop", Vector(0,0));
|
||||||
|
@ -47,6 +47,7 @@ AquariaComboBox::AquariaComboBox() : RenderObject()
|
||||||
selectedItemLabel->setFontSize(8);
|
selectedItemLabel->setFontSize(8);
|
||||||
selectedItemLabel->offset.y = -10;
|
selectedItemLabel->offset.y = -10;
|
||||||
selectedItemLabel->position.x = -50;
|
selectedItemLabel->position.x = -50;
|
||||||
|
selectedItemLabel->scale = textscale;
|
||||||
addChild(selectedItemLabel, PM_POINTER);
|
addChild(selectedItemLabel, PM_POINTER);
|
||||||
|
|
||||||
numDrops = 8;
|
numDrops = 8;
|
||||||
|
@ -62,6 +63,8 @@ AquariaComboBox::AquariaComboBox() : RenderObject()
|
||||||
|
|
||||||
scrollDelay = 0;
|
scrollDelay = 0;
|
||||||
firstScroll = 0;
|
firstScroll = 0;
|
||||||
|
|
||||||
|
this->textscale = textscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AquariaComboBox::destroy()
|
void AquariaComboBox::destroy()
|
||||||
|
@ -230,7 +233,7 @@ void AquariaComboBox::open(float t)
|
||||||
{
|
{
|
||||||
if (i < items.size())
|
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 = 0;
|
||||||
a->alpha.interpolateTo(1, t);
|
a->alpha.interpolateTo(1, t);
|
||||||
a->position.y = (a->getHeight()+2) * ((i-scroll)+1);
|
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 unselectedColor(0.7, 0.7, 0.7);
|
||||||
Vector selectedColor(1,1,1);
|
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;
|
this->combo = combo;
|
||||||
index = idx;
|
index = idx;
|
||||||
|
@ -348,6 +351,7 @@ AquariaComboBoxItem::AquariaComboBoxItem(const std::string &str, int idx, Aquari
|
||||||
label->setText(str);
|
label->setText(str);
|
||||||
label->offset.y = -10;
|
label->offset.y = -10;
|
||||||
label->position.x = -50;
|
label->position.x = -50;
|
||||||
|
label->scale = textscale;
|
||||||
addChild(label, PM_POINTER);
|
addChild(label, PM_POINTER);
|
||||||
|
|
||||||
color = unselectedColor;
|
color = unselectedColor;
|
||||||
|
|
|
@ -195,7 +195,7 @@ class AquariaComboBox;
|
||||||
class AquariaComboBoxItem : public Quad
|
class AquariaComboBoxItem : public Quad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo);
|
AquariaComboBoxItem(const std::string &str, int idx, AquariaComboBox *combo, Vector textscale);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onUpdate(float dt);
|
void onUpdate(float dt);
|
||||||
|
@ -210,7 +210,7 @@ protected:
|
||||||
class AquariaComboBox : public RenderObject
|
class AquariaComboBox : public RenderObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AquariaComboBox();
|
AquariaComboBox(Vector textscale = Vector(1, 1));
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
|
@ -242,6 +242,7 @@ protected:
|
||||||
int selectedItem;
|
int selectedItem;
|
||||||
float scrollDelay;
|
float scrollDelay;
|
||||||
bool firstScroll;
|
bool firstScroll;
|
||||||
|
Vector textscale;
|
||||||
|
|
||||||
std::vector<AquariaComboBoxItem*> shownItems;
|
std::vector<AquariaComboBoxItem*> shownItems;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3382,12 +3382,14 @@ void Game::createInGameMenu()
|
||||||
resolutionLabel->position = Vector(160, 260);
|
resolutionLabel->position = Vector(160, 260);
|
||||||
options->addChild(resolutionLabel, PM_POINTER);
|
options->addChild(resolutionLabel, PM_POINTER);
|
||||||
|
|
||||||
resBox = new AquariaComboBox();
|
resBox = new AquariaComboBox(Vector(0.7f, 1.0f));
|
||||||
resBox->position = Vector(196, 285);
|
resBox->position = Vector(196, 285);
|
||||||
for (i = 0; i < core->screenModes.size(); i++)
|
for (i = 0; i < core->screenModes.size(); i++)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << core->screenModes[i].x << "x" << core->screenModes[i].y;
|
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());
|
resBox->addItem(os.str());
|
||||||
if (core->screenModes[i].x == dsq->user.video.resx && core->screenModes[i].y == dsq->user.video.resy)
|
if (core->screenModes[i].x == dsq->user.video.resx && core->screenModes[i].y == dsq->user.video.resy)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2138,7 +2138,7 @@ void Core::enumerateScreenModes()
|
||||||
SDL_GetDisplayMode(0, i, &mode);
|
SDL_GetDisplayMode(0, i, &mode);
|
||||||
if (mode.w && mode.h && (mode.w > mode.h))
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,10 +70,10 @@ enum TimeUpdateType
|
||||||
|
|
||||||
struct ScreenMode
|
struct ScreenMode
|
||||||
{
|
{
|
||||||
ScreenMode() { idx = x = y = 0; }
|
ScreenMode() { idx = x = y = hz = 0; }
|
||||||
ScreenMode(int i, int x, int y) : idx(i), x(x), y(y) {}
|
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
|
struct CoreSettings
|
||||||
|
|
Loading…
Reference in a new issue