2016-12-10 11:40:41 +01:00
|
|
|
#include <guisan.hpp>
|
|
|
|
#include <SDL_ttf.h>
|
|
|
|
#include <guisan/sdl.hpp>
|
|
|
|
#include "guisan/sdl/sdltruetypefont.hpp"
|
2015-05-13 18:47:23 +00:00
|
|
|
#include "SelectorEntry.hpp"
|
|
|
|
#include "UaeRadioButton.hpp"
|
|
|
|
#include "UaeDropDown.hpp"
|
|
|
|
#include "UaeCheckBox.hpp"
|
|
|
|
|
|
|
|
#include "sysconfig.h"
|
|
|
|
#include "sysdeps.h"
|
|
|
|
#include "options.h"
|
|
|
|
#include "gui.h"
|
|
|
|
#include "gui_handling.h"
|
|
|
|
|
|
|
|
static gcn::UaeCheckBox* chkFrameskip;
|
2017-02-23 01:07:28 +01:00
|
|
|
static gcn::Window* grpScalingMethod;
|
|
|
|
static gcn::UaeRadioButton* optAuto;
|
|
|
|
static gcn::UaeRadioButton* optNearest;
|
|
|
|
static gcn::UaeRadioButton* optLinear;
|
2015-05-13 18:47:23 +00:00
|
|
|
|
|
|
|
class AmigaScreenActionListener : public gcn::ActionListener
|
|
|
|
{
|
2016-09-01 13:53:43 +02:00
|
|
|
public:
|
2017-02-23 01:07:28 +01:00
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
2017-04-14 00:05:31 +02:00
|
|
|
if (actionEvent.getSource() == chkFrameskip)
|
2017-01-29 12:03:00 +01:00
|
|
|
{
|
|
|
|
changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
2015-05-13 18:47:23 +00:00
|
|
|
};
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2015-05-13 18:47:23 +00:00
|
|
|
AmigaScreenActionListener* amigaScreenActionListener;
|
|
|
|
|
2017-02-23 01:07:28 +01:00
|
|
|
class ScalingMethodActionListener : public gcn::ActionListener
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void action(const gcn::ActionEvent& actionEvent) override
|
|
|
|
{
|
|
|
|
if (actionEvent.getSource() == optAuto)
|
|
|
|
changed_prefs.scaling_method = -1;
|
|
|
|
else if (actionEvent.getSource() == optNearest)
|
|
|
|
changed_prefs.scaling_method = 0;
|
|
|
|
else if (actionEvent.getSource() == optLinear)
|
|
|
|
changed_prefs.scaling_method = 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static ScalingMethodActionListener* scalingMethodActionListener;
|
2015-05-13 18:47:23 +00:00
|
|
|
|
|
|
|
void InitPanelDisplay(const struct _ConfigCategory& category)
|
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
amigaScreenActionListener = new AmigaScreenActionListener();
|
|
|
|
|
2017-02-23 23:37:58 +01:00
|
|
|
int posY = DISTANCE_BORDER;
|
|
|
|
|
|
|
|
chkFrameskip = new gcn::UaeCheckBox("Frameskip");
|
|
|
|
chkFrameskip->addActionListener(amigaScreenActionListener);
|
|
|
|
|
|
|
|
category.panel->add(chkFrameskip, DISTANCE_BORDER, posY);
|
|
|
|
posY += DISTANCE_BORDER + chkFrameskip->getHeight() + DISTANCE_NEXT_Y;
|
2017-01-29 12:03:00 +01:00
|
|
|
|
2017-02-23 01:07:28 +01:00
|
|
|
scalingMethodActionListener = new ScalingMethodActionListener();
|
2017-04-14 00:05:31 +02:00
|
|
|
|
2017-02-23 01:07:28 +01:00
|
|
|
optAuto = new gcn::UaeRadioButton("Auto", "radioscalingmethodgroup");
|
|
|
|
optAuto->addActionListener(scalingMethodActionListener);
|
|
|
|
|
|
|
|
optNearest = new gcn::UaeRadioButton("Nearest Neighbor (pixelated)", "radioscalingmethodgroup");
|
|
|
|
optNearest->addActionListener(scalingMethodActionListener);
|
|
|
|
|
|
|
|
optLinear = new gcn::UaeRadioButton("Linear (smooth)", "radioscalingmethodgroup");
|
|
|
|
optLinear->addActionListener(scalingMethodActionListener);
|
|
|
|
|
|
|
|
grpScalingMethod = new gcn::Window("Scaling method");
|
2017-02-23 23:37:58 +01:00
|
|
|
grpScalingMethod->setPosition(DISTANCE_BORDER, posY);
|
2017-02-23 01:07:28 +01:00
|
|
|
grpScalingMethod->add(optAuto, 5, 10);
|
|
|
|
grpScalingMethod->add(optNearest, 5, 40);
|
|
|
|
grpScalingMethod->add(optLinear, 5, 70);
|
|
|
|
grpScalingMethod->setMovable(false);
|
2017-02-23 23:37:58 +01:00
|
|
|
grpScalingMethod->setSize(240, optLinear->getY() + optLinear->getHeight() + 30);
|
2017-02-23 01:07:28 +01:00
|
|
|
grpScalingMethod->setBaseColor(gui_baseCol);
|
|
|
|
|
|
|
|
category.panel->add(grpScalingMethod);
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
RefreshPanelDisplay();
|
2015-05-13 18:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
void ExitPanelDisplay()
|
2015-05-13 18:47:23 +00:00
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
delete chkFrameskip;
|
|
|
|
delete amigaScreenActionListener;
|
2017-02-23 01:07:28 +01:00
|
|
|
|
|
|
|
delete optAuto;
|
|
|
|
delete optNearest;
|
|
|
|
delete optLinear;
|
|
|
|
delete grpScalingMethod;
|
|
|
|
delete scalingMethodActionListener;
|
2015-05-13 18:47:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-29 12:03:00 +01:00
|
|
|
void RefreshPanelDisplay()
|
2015-05-13 18:47:23 +00:00
|
|
|
{
|
2017-01-29 12:03:00 +01:00
|
|
|
chkFrameskip->setSelected(changed_prefs.gfx_framerate);
|
2017-02-23 01:07:28 +01:00
|
|
|
|
|
|
|
if (changed_prefs.scaling_method == -1)
|
|
|
|
optAuto->setSelected(true);
|
|
|
|
else if (changed_prefs.scaling_method == 0)
|
|
|
|
optNearest->setSelected(true);
|
|
|
|
else if (changed_prefs.scaling_method == 1)
|
|
|
|
optLinear->setSelected(true);
|
2015-05-13 18:47:23 +00:00
|
|
|
}
|