diff --git a/stella/src/common/FrameBufferGL.cxx b/stella/src/common/FrameBufferGL.cxx index 8e56df4f3..c60365d40 100644 --- a/stella/src/common/FrameBufferGL.cxx +++ b/stella/src/common/FrameBufferGL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 @@ -295,9 +295,9 @@ cerr << "setVidMode: w = " << mode.screen_w << ", h = " << mode.screen_h << endl // Now re-calculate the dimensions mode.image_w = (Uint16) (stretchFactor * mode.image_w); mode.image_h = (Uint16) (stretchFactor * mode.image_h); - if(!fullScreen()) mode.screen_w = mode.image_w; - mode.image_x = (mode.screen_w - mode.image_w) / 2; - mode.image_y = (mode.screen_h - mode.image_h) / 2; +// if(!fullScreen()) mode.screen_w = mode.image_w; + mode.image_x = (mode.screen_w - mode.image_w) >> 1; + mode.image_y = (mode.screen_h - mode.image_h) >> 1; SDL_GL_SetAttribute( SDL_GL_RED_SIZE, myRGB[0] ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, myRGB[1] ); @@ -382,7 +382,10 @@ cerr << "dimensions: " << endl 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); myTiaSurface->setPos(mode.image_x, mode.image_y); } @@ -429,9 +432,9 @@ void FrameBufferGL::drawMediaSource() // are drawn in postFrameUpdate() myDirtyFlag = true; - buffer[pos] = buffer[pos+1] = (uInt16) myDefPalette[v]; + buffer[pos] = (uInt16) myDefPalette[v]; } - pos += 2; + pos++; } bufofsY += width; screenofsY += pitch; @@ -455,7 +458,6 @@ void FrameBufferGL::drawMediaSource() uInt8 w = previousFrame[bufofs]; buffer[pos++] = (uInt16) myAvgPalette[v][w]; - buffer[pos++] = (uInt16) myAvgPalette[v][w]; } bufofsY += width; screenofsY += pitch; diff --git a/stella/src/debugger/gui/RamWidget.cxx b/stella/src/debugger/gui/RamWidget.cxx index 235cd7dd7..c57865f84 100644 --- a/stella/src/debugger/gui/RamWidget.cxx +++ b/stella/src/debugger/gui/RamWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -269,11 +269,9 @@ void RamWidget::fillGrid(bool updateOld) void RamWidget::showInputBox(int cmd) { // Add inputbox in the middle of the RAM widget - uInt32 tx, ty; - dialog().surface().getPos(tx, ty); - tx += getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1); - ty += getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1); - myInputBox->show(tx, ty); + uInt32 x = getAbsX() + ((getWidth() - myInputBox->getWidth()) >> 1); + uInt32 y = getAbsY() + ((getHeight() - myInputBox->getHeight()) >> 1); + myInputBox->show(x, y); myInputBox->setEditString(""); myInputBox->setTitle(""); myInputBox->setFocus(0); diff --git a/stella/src/debugger/gui/RomListWidget.cxx b/stella/src/debugger/gui/RomListWidget.cxx index 04c91554c..fb82fe1ba 100644 --- a/stella/src/debugger/gui/RomListWidget.cxx +++ b/stella/src/debugger/gui/RomListWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // 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) { // Add menu at current x,y mouse location - uInt32 tx, ty; - dialog().surface().getPos(tx, ty); - x += getAbsX() + tx; - y += getAbsY() + ty; - myMenu->show(x, y); + myMenu->show(x + getAbsX(), y + getAbsY()); } else ListWidget::handleMouseDown(x, y, button, clickCount); diff --git a/stella/src/debugger/gui/TiaOutputWidget.cxx b/stella/src/debugger/gui/TiaOutputWidget.cxx index 682f805fa..62d02cb31 100644 --- a/stella/src/debugger/gui/TiaOutputWidget.cxx +++ b/stella/src/debugger/gui/TiaOutputWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -93,11 +93,7 @@ void TiaOutputWidget::handleMouseDown(int x, int y, int button, int clickCount) myClickY = y; // Add menu at current x,y mouse location - uInt32 tx, ty; - dialog().surface().getPos(tx, ty); - x += getAbsX() + tx; - y += getAbsY() + ty; - myMenu->show(x, y); + myMenu->show(x + getAbsX(), y + getAbsY()); } } diff --git a/stella/src/debugger/gui/TiaZoomWidget.cxx b/stella/src/debugger/gui/TiaZoomWidget.cxx index d0d8c06a5..8c56e6eef 100644 --- a/stella/src/debugger/gui/TiaZoomWidget.cxx +++ b/stella/src/debugger/gui/TiaZoomWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // 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) { // Add menu at current x,y mouse location - uInt32 tx, ty; - dialog().surface().getPos(tx, ty); - x += getAbsX() + tx; - y += getAbsY() + ty; - myMenu->show(x, y); + myMenu->show(x + getAbsX(), y + getAbsY()); } } diff --git a/stella/src/gui/ContextMenu.cxx b/stella/src/gui/ContextMenu.cxx index 1ff8122b3..1397d29d6 100644 --- a/stella/src/gui/ContextMenu.cxx +++ b/stella/src/gui/ContextMenu.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -98,28 +98,23 @@ void ContextMenu::show(uInt32 x, uInt32 y, int item) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 // offset has changed - uInt32 x = _xorig, y = _yorig; const GUI::Rect& image = instance().frameBuffer().imageRect(); + uInt32 x = image.x() + _xorig; + uInt32 y = image.y() + _yorig; uInt32 tx = image.x() + image.width(); 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); - - -/* - 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); -*/ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/InputTextDialog.cxx b/stella/src/gui/InputTextDialog.cxx index c4694c101..90432467d 100644 --- a/stella/src/gui/InputTextDialog.cxx +++ b/stella/src/gui/InputTextDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -35,7 +35,9 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, const StringList& labels) : Dialog(&boss->instance(), &boss->parent(), 0, 0, 16, 16), CommandSender(boss), - myErrorFlag(false) + myErrorFlag(false), + myXOrig(0), + myYOrig(0) { const int fontWidth = font.getMaxCharWidth(), 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 // may not exist before then 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(); - uInt32 dx = image.x() + image.width(); - uInt32 dy = image.y() + image.height(); - if(x + _w > dx) x -= (x + _w - dx); - if(y + _h > dy) y -= (y + _h - dy); + uInt32 x = image.x() + myXOrig; + uInt32 y = image.y() + myYOrig; + uInt32 tx = image.x() + image.width(); + 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); } diff --git a/stella/src/gui/InputTextDialog.hxx b/stella/src/gui/InputTextDialog.hxx index 737ab950a..f152a042c 100644 --- a/stella/src/gui/InputTextDialog.hxx +++ b/stella/src/gui/InputTextDialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -50,7 +50,7 @@ class InputTextDialog : public Dialog, public CommandSender void setFocus(int idx = 0); /** This dialog uses its own positioning, so we override Dialog::center() */ - void center() { } + void center(); protected: virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); @@ -61,6 +61,8 @@ class InputTextDialog : public Dialog, public CommandSender bool myErrorFlag; int myCmd; + + uInt32 myXOrig, myYOrig; }; #endif