mirror of https://github.com/stella-emu/stella.git
Some more UI positioning fixes. InputTextDialog's in the debugger are
now correctly positioned, but there's still an issue with ContextMenus which are used by PromptWidgets. Finally, we see the first performance improvements in OpenGL TIA rendering coming from the new 'surface' infrastructure. Now that TIA and UI surfaces are rendered separately, we no longer have to double the TIA width in software; it can be hardware-accelerated (ie, a 160x200 texture is stretched in hardware). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1571 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
039a0b9e36
commit
b62755ce70
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: FrameBufferGL.cxx,v 1.121 2008-12-21 19:51:34 stephena Exp $
|
// $Id: FrameBufferGL.cxx,v 1.122 2008-12-23 18:54:05 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef DISPLAY_OPENGL
|
#ifdef DISPLAY_OPENGL
|
||||||
|
@ -295,9 +295,9 @@ cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl
|
||||||
// Now re-calculate the dimensions
|
// Now re-calculate the dimensions
|
||||||
mode.image_w = (Uint16) (stretchFactor * mode.image_w);
|
mode.image_w = (Uint16) (stretchFactor * mode.image_w);
|
||||||
mode.image_h = (Uint16) (stretchFactor * mode.image_h);
|
mode.image_h = (Uint16) (stretchFactor * mode.image_h);
|
||||||
if(!fullScreen()) mode.screen_w = mode.image_w;
|
// if(!fullScreen()) mode.screen_w = mode.image_w;
|
||||||
mode.image_x = (mode.screen_w - mode.image_w) / 2;
|
mode.image_x = (mode.screen_w - mode.image_w) >> 1;
|
||||||
mode.image_y = (mode.screen_h - mode.image_h) / 2;
|
mode.image_y = (mode.screen_h - mode.image_h) >> 1;
|
||||||
|
|
||||||
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, myRGB[0] );
|
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, myRGB[0] );
|
||||||
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, myRGB[1] );
|
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, myRGB[1] );
|
||||||
|
@ -382,7 +382,10 @@ cerr << "dimensions: " << endl
|
||||||
|
|
||||||
if(!inUIMode)
|
if(!inUIMode)
|
||||||
{
|
{
|
||||||
myTiaSurface = new FBSurfaceGL(*this, baseWidth, baseHeight,
|
// The actual TIA image is only half of that specified by baseWidth
|
||||||
|
// The stretching can be done in hardware now that the TIA surface
|
||||||
|
// and other UI surfaces are no longer tied together
|
||||||
|
myTiaSurface = new FBSurfaceGL(*this, baseWidth>>1, baseHeight,
|
||||||
mode.image_w, mode.image_h);
|
mode.image_w, mode.image_h);
|
||||||
myTiaSurface->setPos(mode.image_x, mode.image_y);
|
myTiaSurface->setPos(mode.image_x, mode.image_y);
|
||||||
}
|
}
|
||||||
|
@ -429,9 +432,9 @@ void FrameBufferGL::drawMediaSource()
|
||||||
// are drawn in postFrameUpdate()
|
// are drawn in postFrameUpdate()
|
||||||
myDirtyFlag = true;
|
myDirtyFlag = true;
|
||||||
|
|
||||||
buffer[pos] = buffer[pos+1] = (uInt16) myDefPalette[v];
|
buffer[pos] = (uInt16) myDefPalette[v];
|
||||||
}
|
}
|
||||||
pos += 2;
|
pos++;
|
||||||
}
|
}
|
||||||
bufofsY += width;
|
bufofsY += width;
|
||||||
screenofsY += pitch;
|
screenofsY += pitch;
|
||||||
|
@ -455,7 +458,6 @@ void FrameBufferGL::drawMediaSource()
|
||||||
uInt8 w = previousFrame[bufofs];
|
uInt8 w = previousFrame[bufofs];
|
||||||
|
|
||||||
buffer[pos++] = (uInt16) myAvgPalette[v][w];
|
buffer[pos++] = (uInt16) myAvgPalette[v][w];
|
||||||
buffer[pos++] = (uInt16) myAvgPalette[v][w];
|
|
||||||
}
|
}
|
||||||
bufofsY += width;
|
bufofsY += width;
|
||||||
screenofsY += pitch;
|
screenofsY += pitch;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: RamWidget.cxx,v 1.19 2008-06-19 19:15:44 stephena Exp $
|
// $Id: RamWidget.cxx,v 1.20 2008-12-23 18:54:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -269,11 +269,9 @@ void RamWidget::fillGrid(bool updateOld)
|
||||||
void RamWidget::showInputBox(int cmd)
|
void RamWidget::showInputBox(int cmd)
|
||||||
{
|
{
|
||||||
// Add inputbox in the middle of the RAM widget
|
// Add inputbox in the middle of the RAM widget
|
||||||
uInt32 tx, ty;
|
uInt32 x = getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1);
|
||||||
dialog().surface().getPos(tx, ty);
|
uInt32 y = getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1);
|
||||||
tx += getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1);
|
myInputBox->show(x, y);
|
||||||
ty += getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1);
|
|
||||||
myInputBox->show(tx, ty);
|
|
||||||
myInputBox->setEditString("");
|
myInputBox->setEditString("");
|
||||||
myInputBox->setTitle("");
|
myInputBox->setTitle("");
|
||||||
myInputBox->setFocus(0);
|
myInputBox->setFocus(0);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: RomListWidget.cxx,v 1.15 2008-07-25 12:41:41 stephena Exp $
|
// $Id: RomListWidget.cxx,v 1.16 2008-12-23 18:54:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -69,11 +69,7 @@ void RomListWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
if(button == 2)
|
if(button == 2)
|
||||||
{
|
{
|
||||||
// Add menu at current x,y mouse location
|
// Add menu at current x,y mouse location
|
||||||
uInt32 tx, ty;
|
myMenu->show(x + getAbsX(), y + getAbsY());
|
||||||
dialog().surface().getPos(tx, ty);
|
|
||||||
x += getAbsX() + tx;
|
|
||||||
y += getAbsY() + ty;
|
|
||||||
myMenu->show(x, y);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ListWidget::handleMouseDown(x, y, button, clickCount);
|
ListWidget::handleMouseDown(x, y, button, clickCount);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: TiaOutputWidget.cxx,v 1.19 2008-12-20 23:32:46 stephena Exp $
|
// $Id: TiaOutputWidget.cxx,v 1.20 2008-12-23 18:54:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -93,11 +93,7 @@ void TiaOutputWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
myClickY = y;
|
myClickY = y;
|
||||||
|
|
||||||
// Add menu at current x,y mouse location
|
// Add menu at current x,y mouse location
|
||||||
uInt32 tx, ty;
|
myMenu->show(x + getAbsX(), y + getAbsY());
|
||||||
dialog().surface().getPos(tx, ty);
|
|
||||||
x += getAbsX() + tx;
|
|
||||||
y += getAbsY() + ty;
|
|
||||||
myMenu->show(x, y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: TiaZoomWidget.cxx,v 1.18 2008-07-25 12:41:41 stephena Exp $
|
// $Id: TiaZoomWidget.cxx,v 1.19 2008-12-23 18:54:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -139,11 +139,7 @@ void TiaZoomWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
if(button == 2)
|
if(button == 2)
|
||||||
{
|
{
|
||||||
// Add menu at current x,y mouse location
|
// Add menu at current x,y mouse location
|
||||||
uInt32 tx, ty;
|
myMenu->show(x + getAbsX(), y + getAbsY());
|
||||||
dialog().surface().getPos(tx, ty);
|
|
||||||
x += getAbsX() + tx;
|
|
||||||
y += getAbsY() + ty;
|
|
||||||
myMenu->show(x, y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: ContextMenu.cxx,v 1.6 2008-08-04 20:12:23 stephena Exp $
|
// $Id: ContextMenu.cxx,v 1.7 2008-12-23 18:54:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -98,28 +98,23 @@ void ContextMenu::show(uInt32 x, uInt32 y, int item)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ContextMenu::center()
|
void ContextMenu::center()
|
||||||
{
|
{
|
||||||
cerr << " ==> ContextMenu::center()" << endl;
|
/*
|
||||||
|
const GUI::Rect& screen = instance().frameBuffer().screenRect();
|
||||||
|
uInt32 x = (screen.width() - getWidth()) >> 1;
|
||||||
|
uInt32 y = (screen.height() - getHeight()) >> 1;
|
||||||
|
*/
|
||||||
|
|
||||||
// Make sure the menu is exactly where it should be, in case the image
|
// Make sure the menu is exactly where it should be, in case the image
|
||||||
// offset has changed
|
// offset has changed
|
||||||
uInt32 x = _xorig, y = _yorig;
|
|
||||||
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
||||||
|
uInt32 x = image.x() + _xorig;
|
||||||
|
uInt32 y = image.y() + _yorig;
|
||||||
uInt32 tx = image.x() + image.width();
|
uInt32 tx = image.x() + image.width();
|
||||||
uInt32 ty = image.y() + image.height();
|
uInt32 ty = image.y() + image.height();
|
||||||
if(x + _w > tx) x -= (x + _w - tx);
|
if(x + _w > tx) x -= (x + _w - tx);
|
||||||
if(y + _h > ty) y -= (y + _h - ty);
|
if(y + _h > ty) y -= (y + _h - ty);
|
||||||
|
|
||||||
surface().setPos(x, y);
|
surface().setPos(x, y);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
uInt32 tx, ty;
|
|
||||||
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
|
||||||
dialog().surface().getPos(tx, ty);
|
|
||||||
tx += image.x();
|
|
||||||
ty += image.y();
|
|
||||||
surface().setPos(tx, ty);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: InputTextDialog.cxx,v 1.22 2008-06-19 19:15:44 stephena Exp $
|
// $Id: InputTextDialog.cxx,v 1.23 2008-12-23 18:54:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -35,7 +35,9 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
const StringList& labels)
|
const StringList& labels)
|
||||||
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16),
|
: Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16),
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
myErrorFlag(false)
|
myErrorFlag(false),
|
||||||
|
myXOrig(0),
|
||||||
|
myYOrig(0)
|
||||||
{
|
{
|
||||||
const int fontWidth = font.getMaxCharWidth(),
|
const int fontWidth = font.getMaxCharWidth(),
|
||||||
fontHeight = font.getFontHeight(),
|
fontHeight = font.getFontHeight(),
|
||||||
|
@ -101,13 +103,23 @@ void InputTextDialog::show(uInt32 x, uInt32 y)
|
||||||
// Make sure position is set *after* the dialog is added, since the surface
|
// Make sure position is set *after* the dialog is added, since the surface
|
||||||
// may not exist before then
|
// may not exist before then
|
||||||
parent().addDialog(this);
|
parent().addDialog(this);
|
||||||
|
myXOrig = x;
|
||||||
|
myYOrig = y;
|
||||||
|
center();
|
||||||
|
}
|
||||||
|
|
||||||
// Are we in the current screen bounds?
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void InputTextDialog::center()
|
||||||
|
{
|
||||||
|
// Make sure the menu is exactly where it should be, in case the image
|
||||||
|
// offset has changed
|
||||||
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
const GUI::Rect& image = instance().frameBuffer().imageRect();
|
||||||
uInt32 dx = image.x() + image.width();
|
uInt32 x = image.x() + myXOrig;
|
||||||
uInt32 dy = image.y() + image.height();
|
uInt32 y = image.y() + myYOrig;
|
||||||
if(x + _w > dx) x -= (x + _w - dx);
|
uInt32 tx = image.x() + image.width();
|
||||||
if(y + _h > dy) y -= (y + _h - dy);
|
uInt32 ty = image.y() + image.height();
|
||||||
|
if(x + _w > tx) x -= (x + _w - tx);
|
||||||
|
if(y + _h > ty) y -= (y + _h - ty);
|
||||||
|
|
||||||
surface().setPos(x, y);
|
surface().setPos(x, y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: InputTextDialog.hxx,v 1.11 2008-06-19 19:15:44 stephena Exp $
|
// $Id: InputTextDialog.hxx,v 1.12 2008-12-23 18:54:05 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -50,7 +50,7 @@ class InputTextDialog : public Dialog, public CommandSender
|
||||||
void setFocus(int idx = 0);
|
void setFocus(int idx = 0);
|
||||||
|
|
||||||
/** This dialog uses its own positioning, so we override Dialog::center() */
|
/** This dialog uses its own positioning, so we override Dialog::center() */
|
||||||
void center() { }
|
void center();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||||
|
@ -61,6 +61,8 @@ class InputTextDialog : public Dialog, public CommandSender
|
||||||
|
|
||||||
bool myErrorFlag;
|
bool myErrorFlag;
|
||||||
int myCmd;
|
int myCmd;
|
||||||
|
|
||||||
|
uInt32 myXOrig, myYOrig;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue