bsnes/higan/target-ethos/settings/video.cpp

64 lines
2.3 KiB
C++
Executable File

VideoSettings *videoSettings = nullptr;
VideoSlider::VideoSlider() {
append(name, {75, 0});
append(value, {75, 0});
append(slider, {~0, 0});
}
VideoSettings::VideoSettings() {
title.setFont(program->titleFont);
title.setText("Video Settings");
colorAdjustment.setFont(program->boldFont);
colorAdjustment.setText("Color adjustment:");
saturation.name.setText("Saturation:");
saturation.slider.setLength(201);
gamma.name.setText("Gamma:");
gamma.slider.setLength(101);
luminance.name.setText("Luminance:");
luminance.slider.setLength(101);
overscanAdjustment.setFont(program->boldFont);
overscanAdjustment.setText("Overscan mask:");
overscanHorizontal.name.setText("Horizontal:");
overscanHorizontal.slider.setLength(17);
overscanVertical.name.setText("Vertical:");
overscanVertical.slider.setLength(17);
append(title, {~0, 0}, 5);
append(colorAdjustment, {~0, 0});
append(saturation, {~0, 0});
append(gamma, {~0, 0});
append(luminance, {~0, 0}, 5);
append(overscanAdjustment, {~0, 0});
append(overscanHorizontal, {~0, 0});
append(overscanVertical, {~0, 0}, 5);
saturation.slider.setPosition(config->video.saturation);
gamma.slider.setPosition(config->video.gamma - 100);
luminance.slider.setPosition(config->video.luminance);
overscanHorizontal.slider.setPosition(config->video.maskOverscanHorizontal);
overscanVertical.slider.setPosition(config->video.maskOverscanVertical);
synchronize();
saturation.slider.onChange = gamma.slider.onChange = luminance.slider.onChange =
overscanHorizontal.slider.onChange = overscanVertical.slider.onChange =
{&VideoSettings::synchronize, this};
}
void VideoSettings::synchronize() {
config->video.saturation = saturation.slider.position();
config->video.gamma = 100 + gamma.slider.position();
config->video.luminance = luminance.slider.position();
config->video.maskOverscanHorizontal = overscanHorizontal.slider.position();
config->video.maskOverscanVertical = overscanVertical.slider.position();
saturation.value.setText({config->video.saturation, "%"});
gamma.value.setText({config->video.gamma, "%"});
luminance.value.setText({config->video.luminance, "%"});
overscanHorizontal.value.setText({config->video.maskOverscanHorizontal, "px"});
overscanVertical.value.setText({config->video.maskOverscanVertical, "px"});
if(program->active) system().paletteUpdate();
}