Added a targeting reticle icon that can be used as a mouse cursor on the main viewport of Qt GUI. Easier to aim with for zapper games emulated by mouse.
This commit is contained in:
parent
ffd5de60aa
commit
456251861a
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -13,5 +13,6 @@
|
|||
<file>icons/timer.png</file>
|
||||
<file>icons/movie.png</file>
|
||||
<file>icons/camera.png</file>
|
||||
<file>icons/reticle.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -370,6 +370,8 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
cursorSelect->addItem( tr("Arrow") , 0 );
|
||||
cursorSelect->addItem( tr("Cross") , 1 );
|
||||
cursorSelect->addItem( tr("Blank") , 2 );
|
||||
cursorSelect->addItem( tr("Reticle 1x"), 3 );
|
||||
cursorSelect->addItem( tr("Reticle 2x"), 4 );
|
||||
|
||||
setComboBoxFromProperty( cursorSelect, "SDL.CursorType" );
|
||||
|
||||
|
@ -751,30 +753,15 @@ void ConsoleVideoConfDialog_t::regionChanged(int index)
|
|||
void ConsoleVideoConfDialog_t::cursorShapeChanged(int index)
|
||||
{
|
||||
int cursorSel;
|
||||
Qt::CursorShape s;
|
||||
//printf("Scaler: %i : %i \n", index, scalerSelect->itemData(index).toInt() );
|
||||
|
||||
cursorSel = cursorSelect->itemData(index).toInt();
|
||||
|
||||
switch ( cursorSel )
|
||||
{
|
||||
case 2:
|
||||
s = Qt::BlankCursor;
|
||||
break;
|
||||
case 1:
|
||||
s = Qt::CrossCursor;
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
s = Qt::ArrowCursor;
|
||||
cursorSel = 0;
|
||||
break;
|
||||
}
|
||||
consoleWindow->setViewerCursor( s );
|
||||
|
||||
g_config->setOption ("SDL.CursorType", cursorSel);
|
||||
|
||||
g_config->save ();
|
||||
|
||||
consoleWindow->loadCursor();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::cursorVisChanged( int value )
|
||||
|
@ -787,32 +774,7 @@ void ConsoleVideoConfDialog_t::cursorVisChanged( int value )
|
|||
g_config->setOption("SDL.CursorVis", vis );
|
||||
g_config->save ();
|
||||
|
||||
if ( vis )
|
||||
{
|
||||
int opt;
|
||||
Qt::CursorShape s;
|
||||
|
||||
g_config->getOption("SDL.CursorType", &opt );
|
||||
|
||||
switch ( opt )
|
||||
{
|
||||
case 2:
|
||||
s = Qt::BlankCursor;
|
||||
break;
|
||||
case 1:
|
||||
s = Qt::CrossCursor;
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
s = Qt::ArrowCursor;
|
||||
break;
|
||||
}
|
||||
consoleWindow->setViewerCursor( s );
|
||||
}
|
||||
else
|
||||
{
|
||||
consoleWindow->setViewerCursor( Qt::BlankCursor );
|
||||
}
|
||||
consoleWindow->loadCursor();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
QSize ConsoleVideoConfDialog_t::calcNewScreenSize(void)
|
||||
|
|
|
@ -90,7 +90,6 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
|||
int opt, xWinSize = 256, yWinSize = 240;
|
||||
int use_SDL_video = false;
|
||||
int setFullScreen = false;
|
||||
int cursorVis = true;
|
||||
|
||||
//QString libpath = QLibraryInfo::location(QLibraryInfo::PluginsPath);
|
||||
//printf("LibPath: '%s'\n", libpath.toStdString().c_str() );
|
||||
|
@ -193,32 +192,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
|||
recentRomMenuReset = false;
|
||||
|
||||
// Viewport Cursor Type and Visibility
|
||||
g_config->getOption("SDL.CursorVis", &cursorVis );
|
||||
|
||||
if ( cursorVis )
|
||||
{
|
||||
int cursorType;
|
||||
|
||||
g_config->getOption("SDL.CursorType", &cursorType );
|
||||
|
||||
switch ( cursorType )
|
||||
{
|
||||
case 2:
|
||||
setViewerCursor( Qt::BlankCursor );
|
||||
break;
|
||||
case 1:
|
||||
setViewerCursor( Qt::CrossCursor );
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
setViewerCursor( Qt::ArrowCursor );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setViewerCursor( Qt::BlankCursor );
|
||||
}
|
||||
loadCursor();
|
||||
}
|
||||
|
||||
consoleWin_t::~consoleWin_t(void)
|
||||
|
@ -352,6 +326,65 @@ QSize consoleWin_t::calcRequiredSize(void)
|
|||
return out;
|
||||
}
|
||||
|
||||
void consoleWin_t::loadCursor(void)
|
||||
{
|
||||
int cursorVis;
|
||||
|
||||
// Viewport Cursor Type and Visibility
|
||||
g_config->getOption("SDL.CursorVis", &cursorVis );
|
||||
|
||||
if ( cursorVis )
|
||||
{
|
||||
int cursorType;
|
||||
|
||||
g_config->getOption("SDL.CursorType", &cursorType );
|
||||
|
||||
switch ( cursorType )
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
QPixmap reticle(":/icons/reticle.png");
|
||||
|
||||
setViewerCursor( QCursor(reticle.scaled(64,64)) );
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
QPixmap reticle(":/icons/reticle.png");
|
||||
|
||||
setViewerCursor( QCursor(reticle.scaled(32,32)) );
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
setViewerCursor( Qt::BlankCursor );
|
||||
break;
|
||||
case 1:
|
||||
setViewerCursor( Qt::CrossCursor );
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
setViewerCursor( Qt::ArrowCursor );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setViewerCursor( Qt::BlankCursor );
|
||||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::setViewerCursor( QCursor s )
|
||||
{
|
||||
if ( viewport_GL )
|
||||
{
|
||||
viewport_GL->setCursor(s);
|
||||
}
|
||||
else if ( viewport_SDL )
|
||||
{
|
||||
viewport_SDL->setCursor(s);
|
||||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::setViewerCursor( Qt::CursorShape s )
|
||||
{
|
||||
if ( viewport_GL )
|
||||
|
|
|
@ -119,6 +119,8 @@ class consoleWin_t : public QMainWindow
|
|||
|
||||
QSize calcRequiredSize(void);
|
||||
|
||||
void loadCursor(void);
|
||||
void setViewerCursor( QCursor s );
|
||||
void setViewerCursor( Qt::CursorShape s );
|
||||
Qt::CursorShape getViewerCursor(void);
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue