Added option to Qt GUI to allow for setting of the color of the video background side panel color (side panels on either side of video image in fullscreen or large windowed modes).
This commit is contained in:
parent
2b9b2386d3
commit
8fe52cb400
|
@ -125,6 +125,7 @@ void ColorMenuItem::pickerClosed(int ret)
|
|||
|
||||
g_config->save();
|
||||
}
|
||||
emit colorChanged( *colorPtr );
|
||||
}
|
||||
//printf("Picker Closed: %i\n", ret );
|
||||
}
|
||||
|
|
|
@ -56,4 +56,7 @@ class ColorMenuItem : public QAction
|
|||
public slots:
|
||||
void openColorPicker(void);
|
||||
void pickerClosed(int ret);
|
||||
|
||||
signals:
|
||||
void colorChanged( QColor &c );
|
||||
};
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "Qt/throttle.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleViewerGL.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
@ -70,6 +71,8 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
textureType = GL_TEXTURE_2D;
|
||||
//textureType = GL_TEXTURE_RECTANGLE;
|
||||
|
||||
bgColor.setRgb( 0, 0, 0 );
|
||||
|
||||
setMinimumWidth( 256 );
|
||||
setMinimumHeight( 224 );
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
@ -100,6 +103,8 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
g_config->getOption("SDL.YScale", &yscale);
|
||||
|
||||
g_config->getOption ("SDL.ForceAspect", &forceAspect);
|
||||
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", &bgColor );
|
||||
}
|
||||
|
||||
connect( this, SIGNAL(frameSwapped(void)), this, SLOT(renderFinished(void)) );
|
||||
|
@ -363,6 +368,11 @@ void ConsoleViewGL_t::resizeGL(int w, int h)
|
|||
buildTextures();
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::setBgColor( QColor &c )
|
||||
{
|
||||
bgColor = c;
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::setLinearFilterEnable( bool ena )
|
||||
{
|
||||
if ( linearFilter != ena )
|
||||
|
@ -598,7 +608,7 @@ void ConsoleViewGL_t::paintGL(void)
|
|||
glOrtho( 0.0, rw, 0.0, rh, -1.0, 1.0);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glClearColor( 0.0, 0.0f, 0.0f, 0.0f); // Background color to black.
|
||||
glClearColor( bgColor.redF(), bgColor.greenF(), bgColor.blueF(), 1.0f); // Background color to config value.
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QColor>
|
||||
#include <QScreen>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
|
@ -38,6 +39,7 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
|||
double getAspectRatio(void);
|
||||
|
||||
void screenChanged(QScreen *scr);
|
||||
void setBgColor( QColor &c );
|
||||
|
||||
protected:
|
||||
void initializeGL(void);
|
||||
|
@ -74,6 +76,7 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
|||
|
||||
unsigned int textureType;
|
||||
unsigned int mouseButtonMask;
|
||||
QColor bgColor;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "Qt/throttle.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleViewerSDL.h"
|
||||
#include "Qt/ConsoleUtilities.h"
|
||||
|
||||
extern unsigned int gui_draw_area_width;
|
||||
extern unsigned int gui_draw_area_height;
|
||||
|
@ -42,6 +43,8 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
setAutoFillBackground(true);
|
||||
setPalette(pal);
|
||||
|
||||
bgColor.setRgb( 0, 0, 0 );
|
||||
|
||||
setMinimumWidth( 256 );
|
||||
setMinimumHeight( 224 );
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
@ -99,6 +102,8 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
g_config->getOption("SDL.YScale", &yscale);
|
||||
|
||||
g_config->getOption ("SDL.ForceAspect", &forceAspect);
|
||||
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", &bgColor );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,6 +126,11 @@ ConsoleViewSDL_t::~ConsoleViewSDL_t(void)
|
|||
}
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::setBgColor( QColor &c )
|
||||
{
|
||||
bgColor = c;
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::setLinearFilterEnable( bool ena )
|
||||
{
|
||||
if ( ena != linearFilter )
|
||||
|
@ -633,7 +643,7 @@ void ConsoleViewSDL_t::render(void)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_SetRenderDrawColor( sdlRenderer, 0, 0, 0, 0 );
|
||||
SDL_SetRenderDrawColor( sdlRenderer, bgColor.red(), bgColor.green(), bgColor.blue(), 255 );
|
||||
|
||||
SDL_RenderClear(sdlRenderer);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
#include <QCursor>
|
||||
#include <QPaintEvent>
|
||||
#include <QResizeEvent>
|
||||
|
@ -41,6 +42,7 @@ class ConsoleViewSDL_t : public QWidget
|
|||
|
||||
void setCursor(const QCursor &c);
|
||||
void setCursor( Qt::CursorShape s );
|
||||
void setBgColor( QColor &c );
|
||||
protected:
|
||||
|
||||
//void paintEvent(QPaintEvent *event);
|
||||
|
@ -69,6 +71,7 @@ class ConsoleViewSDL_t : public QWidget
|
|||
bool linearFilter;
|
||||
bool forceAspect;
|
||||
bool autoScaleEna;
|
||||
QColor bgColor;
|
||||
|
||||
uint32_t *localBuf;
|
||||
uint32_t localBufSize;
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/input.h"
|
||||
#include "Qt/ColorMenu.h"
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
#include "Qt/InputConf.h"
|
||||
#include "Qt/GamePadConf.h"
|
||||
|
@ -868,6 +869,7 @@ void consoleWin_t::createMainMenu(void)
|
|||
QActionGroup *group;
|
||||
int useNativeMenuBar;
|
||||
int customAutofireOnFrames, customAutofireOffFrames;
|
||||
ColorMenuItem *bgColorItem;
|
||||
//QShortcut *shortcut;
|
||||
|
||||
menubar = new consoleMenuBar(this);
|
||||
|
@ -1214,6 +1216,15 @@ void consoleWin_t::createMainMenu(void)
|
|||
Hotkeys[ HK_MAIN_MENU_HIDE ].setAction( act );
|
||||
connect( Hotkeys[ HK_MAIN_MENU_HIDE ].getShortcut(), SIGNAL(activated()), this, SLOT(toggleMenuVis(void)) );
|
||||
|
||||
// Options -> Video BG Color
|
||||
fceuLoadConfigColor( "SDL.VideoBgColor", &videoBgColor );
|
||||
|
||||
bgColorItem = new ColorMenuItem( tr("BG Side Panel Color"), "SDL.VideoBgColor", this );
|
||||
bgColorItem->connectColor( &videoBgColor );
|
||||
|
||||
optMenu->addAction(bgColorItem);
|
||||
|
||||
connect( bgColorItem, SIGNAL(colorChanged(QColor&)), this, SLOT(videoBgColorChanged(QColor&)) );
|
||||
//-----------------------------------------------------------------------
|
||||
// Emulation
|
||||
|
||||
|
@ -2069,6 +2080,22 @@ void consoleWin_t::closeApp(void)
|
|||
qApp->quit();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void consoleWin_t::videoBgColorChanged( QColor &c )
|
||||
{
|
||||
//printf("Color Changed\n");
|
||||
|
||||
if ( viewport_GL )
|
||||
{
|
||||
viewport_GL->setBgColor(c);
|
||||
viewport_GL->update();
|
||||
}
|
||||
else if ( viewport_SDL )
|
||||
{
|
||||
viewport_SDL->setBgColor(c);
|
||||
viewport_SDL->render();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int consoleWin_t::showListSelectDialog( const char *title, std::vector <std::string> &l )
|
||||
{
|
||||
if ( QThread::currentThread() == emulatorThread )
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QThread>
|
||||
#include <QCursor>
|
||||
#include <QMutex>
|
||||
#include <QColor>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
#include <QRecursiveMutex>
|
||||
#endif
|
||||
|
@ -250,6 +251,7 @@ class consoleWin_t : public QMainWindow
|
|||
//QAction *aviMsgAct;
|
||||
|
||||
QTimer *gameTimer;
|
||||
QColor videoBgColor;
|
||||
|
||||
std::string errorMsg;
|
||||
bool errorMsgValid;
|
||||
|
@ -439,6 +441,7 @@ class consoleWin_t : public QMainWindow
|
|||
void winScreenChanged( QScreen *scr );
|
||||
void winActiveChanged(void);
|
||||
void emuFrameFinish(void);
|
||||
void videoBgColorChanged( QColor &c );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -525,6 +525,7 @@ InitConfig()
|
|||
// video controls
|
||||
config->addOption('f', "fullscreen", "SDL.Fullscreen", 0);
|
||||
config->addOption("videoDriver", "SDL.VideoDriver", 0);
|
||||
config->addOption("SDL.VideoBgColor", "#000000");
|
||||
|
||||
// set x/y res to 0 for automatic fullscreen resolution detection (no change)
|
||||
config->addOption('x', "xres", "SDL.XResolution", 0);
|
||||
|
|
Loading…
Reference in New Issue