Added grid lines to the PPU pattern table viewer for the Qt GUI.
This commit is contained in:
parent
7ce62ebee3
commit
909e3c0c20
|
@ -352,11 +352,8 @@ void ppuPatternView_t::keyPressEvent(QKeyEvent *event)
|
||||||
mode = !mode;
|
mode = !mode;
|
||||||
}
|
}
|
||||||
else if ( event->key() == Qt::Key_G )
|
else if ( event->key() == Qt::Key_G )
|
||||||
{
|
|
||||||
if ( mode )
|
|
||||||
{
|
{
|
||||||
drawTileGrid = !drawTileGrid;
|
drawTileGrid = !drawTileGrid;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( event->key() == Qt::Key_E )
|
else if ( event->key() == Qt::Key_E )
|
||||||
{
|
{
|
||||||
|
@ -425,13 +422,6 @@ void ppuPatternView_t::contextMenuEvent(QContextMenuEvent *event)
|
||||||
act->setShortcut( QKeySequence(tr("Z")));
|
act->setShortcut( QKeySequence(tr("Z")));
|
||||||
connect( act, SIGNAL(triggered(void)), this, SLOT(exitTileMode(void)) );
|
connect( act, SIGNAL(triggered(void)), this, SLOT(exitTileMode(void)) );
|
||||||
menu.addAction( act );
|
menu.addAction( act );
|
||||||
|
|
||||||
act = new QAction(tr("Draw Tile Grid Lines"), &menu);
|
|
||||||
act->setCheckable(true);
|
|
||||||
act->setChecked(drawTileGrid);
|
|
||||||
act->setShortcut( QKeySequence(tr("G")));
|
|
||||||
connect( act, SIGNAL(triggered(void)), this, SLOT(toggleTileGridLines(void)) );
|
|
||||||
menu.addAction( act );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -443,6 +433,13 @@ void ppuPatternView_t::contextMenuEvent(QContextMenuEvent *event)
|
||||||
menu.addAction( act );
|
menu.addAction( act );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
act = new QAction(tr("Draw Tile Grid Lines"), &menu);
|
||||||
|
act->setCheckable(true);
|
||||||
|
act->setChecked(drawTileGrid);
|
||||||
|
act->setShortcut( QKeySequence(tr("G")));
|
||||||
|
connect( act, SIGNAL(triggered(void)), this, SLOT(toggleTileGridLines(void)) );
|
||||||
|
menu.addAction( act );
|
||||||
|
|
||||||
act = new QAction(tr("Next Palette"), &menu);
|
act = new QAction(tr("Next Palette"), &menu);
|
||||||
act->setShortcut( QKeySequence(tr("P")));
|
act->setShortcut( QKeySequence(tr("P")));
|
||||||
connect( act, SIGNAL(triggered(void)), this, SLOT(cycleNextPalette(void)) );
|
connect( act, SIGNAL(triggered(void)), this, SLOT(cycleNextPalette(void)) );
|
||||||
|
@ -567,9 +564,16 @@ void ppuPatternView_t::paintEvent(QPaintEvent *event)
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
viewWidth = event->rect().width();
|
viewWidth = event->rect().width();
|
||||||
viewHeight = event->rect().height();
|
viewHeight = event->rect().height();
|
||||||
|
QPen pen;
|
||||||
|
|
||||||
|
pen = painter.pen();
|
||||||
|
|
||||||
//printf("PPU PatternView %ix%i \n", viewWidth, viewHeight );
|
//printf("PPU PatternView %ix%i \n", viewWidth, viewHeight );
|
||||||
|
|
||||||
|
pen.setWidth( 1 );
|
||||||
|
pen.setColor( QColor( 128, 128, 128) );
|
||||||
|
painter.setPen( pen );
|
||||||
|
|
||||||
w = viewWidth / 128;
|
w = viewWidth / 128;
|
||||||
h = viewHeight / 128;
|
h = viewHeight / 128;
|
||||||
|
|
||||||
|
@ -664,6 +668,23 @@ void ppuPatternView_t::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( drawTileGrid )
|
||||||
|
{
|
||||||
|
xx = 0; y = 128*h;
|
||||||
|
|
||||||
|
for (i=0; i<16; i++) //Columns
|
||||||
|
{
|
||||||
|
painter.drawLine( xx, 0 , xx, y ); xx += (8*w);
|
||||||
|
}
|
||||||
|
|
||||||
|
yy = 0; x = 128*w;
|
||||||
|
|
||||||
|
for (j=0; j<16; j++) //Rows
|
||||||
|
{
|
||||||
|
painter.drawLine( 0, yy , x, yy ); yy += (8*h);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -688,6 +709,23 @@ void ppuPatternView_t::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( drawTileGrid )
|
||||||
|
{
|
||||||
|
xx = 0; y = 128*h;
|
||||||
|
|
||||||
|
for (i=0; i<16; i++) //Columns
|
||||||
|
{
|
||||||
|
painter.drawLine( xx, 0 , xx, y ); xx += (8*w);
|
||||||
|
}
|
||||||
|
|
||||||
|
yy = 0; x = 128*w;
|
||||||
|
|
||||||
|
for (j=0; j<16; j++) //Rows
|
||||||
|
{
|
||||||
|
painter.drawLine( 0, yy , x, yy ); yy += (8*h);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
@ -1622,6 +1660,10 @@ void ppuTileView_t::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
if ( drawTileGrid )
|
if ( drawTileGrid )
|
||||||
{
|
{
|
||||||
|
pen.setWidth( 1 );
|
||||||
|
pen.setColor( QColor(128,128,128) );
|
||||||
|
painter.setPen( pen );
|
||||||
|
|
||||||
// Draw Tile Pixel grid lines
|
// Draw Tile Pixel grid lines
|
||||||
xx = 0; y = 8*h;
|
xx = 0; y = 8*h;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue