Implemented Refresh rate slider

This commit is contained in:
Dimitris Panokostas 2020-07-14 01:48:41 +02:00
parent 49d3098233
commit 72a7d5143f
3 changed files with 22 additions and 6 deletions

View file

@ -7659,11 +7659,6 @@ static void fpscounter (bool frameok)
if (bogusframe || int(last) < 0) if (bogusframe || int(last) < 0)
return; return;
#ifdef AMIBERRY // frameskip
if (currprefs.gfx_framerate == 2)
idletime >>= 1;
#endif
mavg (&fps_mavg, last / 10, FPSCOUNTER_MAVG_SIZE); mavg (&fps_mavg, last / 10, FPSCOUNTER_MAVG_SIZE);
mavg (&idle_mavg, idletime / 10, FPSCOUNTER_MAVG_SIZE); mavg (&idle_mavg, idletime / 10, FPSCOUNTER_MAVG_SIZE);
idletime = 0; idletime = 0;

View file

@ -218,6 +218,7 @@ static NavigationMap navMap[] =
{ "CorrectAR", "Display", "Display", "Linear (smooth)", "chkFlickerFixer" }, { "CorrectAR", "Display", "Display", "Linear (smooth)", "chkFlickerFixer" },
{ "chkFlickerFixer", "Display", "Display", "CorrectAR", "chkFrameskip" }, { "chkFlickerFixer", "Display", "Display", "CorrectAR", "chkFrameskip" },
{ "chkFrameskip", "Display", "Display", "chkFlickerFixer", "sldWidth" }, { "chkFrameskip", "Display", "Display", "chkFlickerFixer", "sldWidth" },
{ "sldRefresh", "", "", "chkFlickerFixer", "sldWidth" },
{ "Vertical", "", "", "Horizontal", "Single" }, { "Vertical", "", "", "Horizontal", "Single" },
{ "Horizontal", "chkAutoHeight", "", "", "Vertical" }, { "Horizontal", "chkAutoHeight", "", "", "Vertical" },

View file

@ -67,6 +67,7 @@ static gcn::Slider* sldAmigaHeight;
static gcn::CheckBox* chkAutoHeight; static gcn::CheckBox* chkAutoHeight;
static gcn::CheckBox* chkFrameskip; static gcn::CheckBox* chkFrameskip;
static gcn::Slider* sldRefresh;
static gcn::CheckBox* chkAspect; static gcn::CheckBox* chkAspect;
static gcn::Label* lblScreenmode; static gcn::Label* lblScreenmode;
@ -96,8 +97,15 @@ public:
changed_prefs.gfx_auto_height = chkAutoHeight->isSelected(); changed_prefs.gfx_auto_height = chkAutoHeight->isSelected();
else if (actionEvent.getSource() == chkFrameskip) else if (actionEvent.getSource() == chkFrameskip)
{
changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 2 : 1; changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 2 : 1;
sldRefresh->setEnabled(chkFrameskip->isSelected());
sldRefresh->setValue(changed_prefs.gfx_framerate);
}
else if (actionEvent.getSource() == sldRefresh)
changed_prefs.gfx_framerate = static_cast<int>(sldRefresh->getValue());
else if (actionEvent.getSource() == chkAspect) else if (actionEvent.getSource() == chkAspect)
changed_prefs.gfx_correct_aspect = chkAspect->isSelected(); changed_prefs.gfx_correct_aspect = chkAspect->isSelected();
@ -230,6 +238,14 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
chkFrameskip->setId("chkFrameskip"); chkFrameskip->setId("chkFrameskip");
chkFrameskip->addActionListener(amigaScreenActionListener); chkFrameskip->addActionListener(amigaScreenActionListener);
sldRefresh = new gcn::Slider(1, 10);
sldRefresh->setSize(100, SLIDER_HEIGHT);
sldRefresh->setBaseColor(gui_baseCol);
sldRefresh->setMarkerLength(20);
sldRefresh->setStepLength(1);
sldRefresh->setId("sldRefresh");
sldRefresh->addActionListener(amigaScreenActionListener);
lblScreenmode = new gcn::Label("Screen mode:"); lblScreenmode = new gcn::Label("Screen mode:");
lblScreenmode->setAlignment(gcn::Graphics::RIGHT); lblScreenmode->setAlignment(gcn::Graphics::RIGHT);
cboScreenmode = new gcn::DropDown(&fullscreen_modes_list); cboScreenmode = new gcn::DropDown(&fullscreen_modes_list);
@ -337,6 +353,7 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
category.panel->add(chkFlickerFixer, DISTANCE_BORDER, posY); category.panel->add(chkFlickerFixer, DISTANCE_BORDER, posY);
posY += chkFlickerFixer->getHeight() + DISTANCE_NEXT_Y; posY += chkFlickerFixer->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkFrameskip, DISTANCE_BORDER, posY); category.panel->add(chkFrameskip, DISTANCE_BORDER, posY);
category.panel->add(sldRefresh, chkFrameskip->getX() + chkFrameskip->getWidth() + DISTANCE_NEXT_X, posY);
RefreshPanelDisplay(); RefreshPanelDisplay();
} }
@ -345,6 +362,7 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
void ExitPanelDisplay() void ExitPanelDisplay()
{ {
delete chkFrameskip; delete chkFrameskip;
delete sldRefresh;
delete amigaScreenActionListener; delete amigaScreenActionListener;
delete lblAmigaWidth; delete lblAmigaWidth;
delete sldAmigaWidth; delete sldAmigaWidth;
@ -380,7 +398,9 @@ void ExitPanelDisplay()
void RefreshPanelDisplay() void RefreshPanelDisplay()
{ {
chkFrameskip->setSelected(changed_prefs.gfx_framerate > 1); chkFrameskip->setSelected(changed_prefs.gfx_framerate > 1);
sldRefresh->setEnabled(chkFrameskip->isSelected());
sldRefresh->setValue(changed_prefs.gfx_framerate);
int i; int i;
char tmp[32]; char tmp[32];