diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-07-02 04:57:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-07-02 04:57:16 +0300 |
commit | 5f43cf85c7e59f0e1192f803560848777d64743f (patch) | |
tree | 283ddb56228ab7b19a62be6f6be0344e77745757 /src | |
parent | ca58a3cced99fc2a8989da0155c1927bc0f08b6f (diff) | |
download | plus-5f43cf85c7e59f0e1192f803560848777d64743f.tar.gz plus-5f43cf85c7e59f0e1192f803560848777d64743f.tar.bz2 plus-5f43cf85c7e59f0e1192f803560848777d64743f.tar.xz plus-5f43cf85c7e59f0e1192f803560848777d64743f.zip |
Replace some getters to direct members access in graphics class.
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 4 | ||||
-rw-r--r-- | src/graphics.h | 5 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/gui.cpp | 2 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 8 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 24 | ||||
-rw-r--r-- | src/gui/spellpopup.cpp | 8 | ||||
-rw-r--r-- | src/gui/statuspopup.cpp | 6 | ||||
-rw-r--r-- | src/gui/textpopup.cpp | 6 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/popup.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 80 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 4 | ||||
-rw-r--r-- | src/imageparticle.cpp | 4 | ||||
-rw-r--r-- | src/map.cpp | 10 | ||||
-rw-r--r-- | src/resources/ambientlayer.cpp | 12 |
16 files changed, 100 insertions, 99 deletions
diff --git a/src/game.cpp b/src/game.cpp index bb477b2e0..2d204499d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -344,8 +344,8 @@ Game::Game(): // Create the viewport viewport = new Viewport; - viewport->setDimension(gcn::Rectangle(0, 0, graphics->getWidth(), - graphics->getHeight())); + viewport->setDimension(gcn::Rectangle(0, 0, graphics->mWidth, + graphics->mHeight)); gcn::Container *top = static_cast<gcn::Container*>(gui->getTop()); top->add(viewport); diff --git a/src/graphics.h b/src/graphics.h index e18b58e75..a6e2941d2 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -263,12 +263,13 @@ class Graphics : public gcn::SDLGraphics bool getRedraw() { return mRedraw; } + int mWidth; + int mHeight; + protected: int SDL_FakeUpperBlit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); - int mWidth; - int mHeight; int mBpp; bool mFullscreen; bool mHWAccel; diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 0d45590ba..1ff375299 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -646,8 +646,8 @@ void ChatWindow::mouseDragged(gcn::MouseEvent &event) { int newX = std::max(0, getX() + event.getX() - mDragOffsetX); int newY = std::max(0, getY() + event.getY() - mDragOffsetY); - newX = std::min(graphics->getWidth() - getWidth(), newX); - newY = std::min(graphics->getHeight() - getHeight(), newY); + newX = std::min(graphics->mWidth - getWidth(), newX); + newY = std::min(graphics->mHeight - getHeight(), newY); setPosition(newX, newY); } } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 51d2f9adf..05b168b5e 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -100,7 +100,7 @@ Gui::Gui(Graphics *graphics): WindowContainer *guiTop = new WindowContainer; guiTop->setFocusable(true); guiTop->setDimension(gcn::Rectangle(0, 0, - graphics->getWidth(), graphics->getHeight())); + graphics->mWidth, graphics->mHeight)); guiTop->setOpaque(false); Window::setWindowContainer(guiTop); setTop(guiTop); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 12669415d..33d0425e1 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -1912,10 +1912,10 @@ void PopupMenu::showUndressPopup(int x, int y, Being *being, Item *item) void PopupMenu::showPopup(int x, int y) { setContentSize(mBrowserBox->getWidth() + 8, mBrowserBox->getHeight() + 8); - if (graphics->getWidth() < (x + getWidth() + 5)) - x = graphics->getWidth() - getWidth(); - if (graphics->getHeight() < (y + getHeight() + 5)) - y = graphics->getHeight() - getHeight(); + if (graphics->mWidth < (x + getWidth() + 5)) + x = graphics->mWidth - getWidth(); + if (graphics->mHeight < (y + getHeight() + 5)) + y = graphics->mHeight - getHeight(); setPosition(x, y); setVisible(true); requestMoveToTop(); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index db2dabcd1..e6578d34f 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -157,8 +157,8 @@ ModeListModel::ModeListModel() addCustomMode("1280x1024"); addCustomMode("1400x900"); addCustomMode("1500x990"); - addCustomMode(toString(graphics->getWidth()) + "x" - + toString(graphics->getHeight())); + addCustomMode(toString(graphics->mWidth) + "x" + + toString(graphics->mHeight)); std::sort(mVideoModes.begin(), mVideoModes.end(), modeSorter); mVideoModes.push_back("custom"); @@ -409,8 +409,8 @@ Setup_Video::Setup_Video(): mFpsCheckBox->setSelected(mFps > 0); // Pre-select the current video mode. - std::string videoMode = toString(graphics->getWidth()) + "x" - + toString(graphics->getHeight()); + std::string videoMode = toString(graphics->mWidth) + "x" + + toString(graphics->mHeight); mModeList->setSelected(mModeListModel->getIndexOf(videoMode)); mModeList->setActionEventId("videomode"); @@ -703,11 +703,11 @@ void Setup_Video::cancel() config.setValue("screen", mFullScreenEnabled); // Set back to the current video mode. - std::string videoMode = toString(graphics->getWidth()) + "x" - + toString(graphics->getHeight()); + std::string videoMode = toString(graphics->mWidth) + "x" + + toString(graphics->mHeight); mModeList->setSelected(mModeListModel->getIndexOf(videoMode)); - config.setValue("screenwidth", graphics->getWidth()); - config.setValue("screenheight", graphics->getHeight()); + config.setValue("screenwidth", graphics->mWidth); + config.setValue("screenheight", graphics->mHeight); config.setValue("customcursor", mCustomCursorEnabled); config.setValue("visiblenames", mVisibleNamesEnabled); @@ -763,9 +763,9 @@ void Setup_Video::action(const gcn::ActionEvent &event) return; // TODO: Find out why the drawing area doesn't resize without a restart. - if (width != graphics->getWidth() || height != graphics->getHeight()) + if (width != graphics->mWidth || height != graphics->mHeight) { - if (width < graphics->getWidth() || height < graphics->getHeight()) + if (width < graphics->mWidth || height < graphics->mHeight) new OkDialog(_("Screen Resolution Changed"), _("Restart your client for the change to take effect.") + std::string("\n") + @@ -776,8 +776,8 @@ void Setup_Video::action(const gcn::ActionEvent &event) } config.setValue("oldscreen", config.getBoolValue("screen")); - config.setValue("oldscreenwidth", graphics->getWidth()); - config.setValue("oldscreenheight", graphics->getHeight()); + config.setValue("oldscreenwidth", graphics->mWidth); + config.setValue("oldscreenheight", graphics->mHeight); config.setValue("screenwidth", width); config.setValue("screenheight", height); } diff --git a/src/gui/spellpopup.cpp b/src/gui/spellpopup.cpp index 3c6d17599..e867ec4e8 100644 --- a/src/gui/spellpopup.cpp +++ b/src/gui/spellpopup.cpp @@ -78,14 +78,14 @@ void SpellPopup::view(int x, int y) int posX = std::max(0, x - getWidth() / 2); int posY = y + distance; - if (posX + getWidth() > graphics->getWidth()) + if (posX + getWidth() > graphics->mWidth) { - if (graphics->getWidth() > getWidth()) - posX = graphics->getWidth() - getWidth(); + if (graphics->mWidth > getWidth()) + posX = graphics->mWidth - getWidth(); else posX = 0; } - if (posY + getHeight() > graphics->getHeight()) + if (posY + getHeight() > graphics->mHeight) { if (y > getHeight() + distance) posY = y - getHeight() - distance; diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp index 9ac2cfad0..c4216013a 100644 --- a/src/gui/statuspopup.cpp +++ b/src/gui/statuspopup.cpp @@ -167,9 +167,9 @@ void StatusPopup::view(int x, int y) int posX = std::max(0, x - getWidth() / 2); int posY = y + distance; - if (posX + getWidth() > graphics->getWidth()) - posX = graphics->getWidth() - getWidth(); - if (posY + getHeight() > graphics->getHeight()) + if (posX + getWidth() > graphics->mWidth) + posX = graphics->mWidth - getWidth(); + if (posY + getHeight() > graphics->mHeight) posY = y - getHeight() - distance; update(); diff --git a/src/gui/textpopup.cpp b/src/gui/textpopup.cpp index 049f86d76..4114706a6 100644 --- a/src/gui/textpopup.cpp +++ b/src/gui/textpopup.cpp @@ -94,9 +94,9 @@ void TextPopup::show(int x, int y, const std::string &str1, int posX = std::max(0, x - getWidth() / 2); int posY = y + distance; - if (posX + getWidth() > graphics->getWidth()) - posX = graphics->getWidth() - getWidth(); - if (posY + getHeight() > graphics->getHeight()) + if (posX + getWidth() > graphics->mWidth) + posX = graphics->mWidth - getWidth(); + if (posY + getHeight() > graphics->mHeight) posY = y - getHeight() - distance; setPosition(posX, posY); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index d2c0db7b1..1b8769602 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -133,8 +133,8 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) lastTick = tick_time; // Calculate viewpoint - int midTileX = (graphics->getWidth() + mScrollCenterOffsetX) / 2; - int midTileY = (graphics->getHeight() + mScrollCenterOffsetX) / 2; + int midTileX = (graphics->mWidth + mScrollCenterOffsetX) / 2; + int midTileY = (graphics->mHeight + mScrollCenterOffsetX) / 2; const Vector &playerPos = player_node->getPosition(); const int player_x = static_cast<int>(playerPos.x) @@ -176,8 +176,8 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) } // Auto center when player is off screen - if (player_x - static_cast<int>(mPixelViewX) > graphics->getWidth() / 2 - || static_cast<int>(mPixelViewX) - player_x > graphics->getWidth() / 2 + if (player_x - static_cast<int>(mPixelViewX) > graphics->mWidth / 2 + || static_cast<int>(mPixelViewX) - player_x > graphics->mWidth / 2 || static_cast<int>(mPixelViewY) - player_y > graphics->getHeight() / 2 || player_y - static_cast<int>(mPixelViewY) @@ -189,9 +189,9 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) // Don't move camera so that the end of the map is on screen const int viewXmax = - mMap->getWidth() * mMap->getTileWidth() - graphics->getWidth(); + mMap->getWidth() * mMap->getTileWidth() - graphics->mWidth; const int viewYmax = - mMap->getHeight() * mMap->getTileHeight() - graphics->getHeight(); + mMap->getHeight() * mMap->getTileHeight() - graphics->mHeight; if (mMap) { if (mPixelViewX < 0) diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 444d147ff..f81b4ac7b 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -44,8 +44,8 @@ Popup::Popup(const std::string &name, const std::string &skin): mPopupName(name), mMinWidth(100), mMinHeight(40), - mMaxWidth(graphics->getWidth()), - mMaxHeight(graphics->getHeight()), + mMaxWidth(graphics->mWidth), + mMaxHeight(graphics->mHeight), mVertexes(new GraphicsVertexes()), mRedraw(true) { @@ -190,9 +190,9 @@ void Popup::position(int x, int y) int posX = std::max(0, x - getWidth() / 2); int posY = y + distance; - if (posX + getWidth() > graphics->getWidth()) - posX = graphics->getWidth() - getWidth(); - if (posY + getHeight() > graphics->getHeight()) + if (posX + getWidth() > graphics->mWidth) + posX = graphics->mWidth - getWidth(); + if (posY + getHeight() > graphics->mHeight) posY = y - getHeight() - distance; setPosition(posX, posY); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index bdf3f5b7c..7b88f0421 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -62,8 +62,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent, mSticky(false), mMinWinWidth(100), mMinWinHeight(40), - mMaxWinWidth(graphics->getWidth()), - mMaxWinHeight(graphics->getHeight()), + mMaxWinWidth(graphics->mWidth), + mMaxWinHeight(graphics->mHeight), mVertexes(new GraphicsVertexes()), mRedraw(true) { @@ -247,39 +247,39 @@ void Window::setLocationRelativeTo(ImageRect::ImagePosition position, } else if (position == ImageRect::UPPER_CENTER) { - offsetX += (graphics->getWidth() - getWidth()) / 2; + offsetX += (graphics->mWidth - getWidth()) / 2; } else if (position == ImageRect::UPPER_RIGHT) { - offsetX += graphics->getWidth() - getWidth(); + offsetX += graphics->mWidth - getWidth(); } else if (position == ImageRect::LEFT) { - offsetY += (graphics->getHeight() - getHeight()) / 2; + offsetY += (graphics->mHeight - getHeight()) / 2; } else if (position == ImageRect::CENTER) { - offsetX += (graphics->getWidth() - getWidth()) / 2; - offsetY += (graphics->getHeight() - getHeight()) / 2; + offsetX += (graphics->mWidth - getWidth()) / 2; + offsetY += (graphics->mHeight - getHeight()) / 2; } else if (position == ImageRect::RIGHT) { - offsetX += graphics->getWidth() - getWidth(); - offsetY += (graphics->getHeight() - getHeight()) / 2; + offsetX += graphics->mWidth - getWidth(); + offsetY += (graphics->mHeight - getHeight()) / 2; } else if (position == ImageRect::LOWER_LEFT) { - offsetY += graphics->getHeight() - getHeight(); + offsetY += graphics->mHeight - getHeight(); } else if (position == ImageRect::LOWER_CENTER) { - offsetX += (graphics->getWidth() - getWidth()) / 2; - offsetY += graphics->getHeight() - getHeight(); + offsetX += (graphics->mWidth - getWidth()) / 2; + offsetY += graphics->mHeight - getHeight(); } else if (position == ImageRect::LOWER_RIGHT) { - offsetX += graphics->getWidth() - getWidth(); - offsetY += graphics->getHeight() - getHeight(); + offsetX += graphics->mWidth - getWidth(); + offsetY += graphics->mHeight - getHeight(); } setPosition(offsetX, offsetY); @@ -555,8 +555,8 @@ void Window::mouseDragged(gcn::MouseEvent &event) { int newX = std::max(0, getX()); int newY = std::max(0, getY()); - newX = std::min(graphics->getWidth() - getWidth(), newX); - newY = std::min(graphics->getHeight() - getHeight(), newY); + newX = std::min(graphics->mWidth - getWidth(), newX); + newY = std::min(graphics->mHeight - getHeight(), newY); setPosition(newX, newY); } @@ -597,13 +597,13 @@ void Window::mouseDragged(gcn::MouseEvent &event) newDim.height += newDim.y; newDim.y = 0; } - if (newDim.x + newDim.width > graphics->getWidth()) + if (newDim.x + newDim.width > graphics->mWidth) { - newDim.width = graphics->getWidth() - newDim.x; + newDim.width = graphics->mWidth - newDim.x; } - if (newDim.y + newDim.height > graphics->getHeight()) + if (newDim.y + newDim.height > graphics->mHeight) { - newDim.height = graphics->getHeight() - newDim.y; + newDim.height = graphics->mHeight - newDim.y; } // Update mouse offset when dragging bottom or right border @@ -765,39 +765,39 @@ void Window::setDefaultSize(int defaultWidth, int defaultHeight, } else if (position == ImageRect::UPPER_CENTER) { - x = (graphics->getWidth() - defaultWidth) / 2; + x = (graphics->mWidth - defaultWidth) / 2; } else if (position == ImageRect::UPPER_RIGHT) { - x = graphics->getWidth() - defaultWidth; + x = graphics->mWidth - defaultWidth; } else if (position == ImageRect::LEFT) { - y = (graphics->getHeight() - defaultHeight) / 2; + y = (graphics->mHeight - defaultHeight) / 2; } else if (position == ImageRect::CENTER) { - x = (graphics->getWidth() - defaultWidth) / 2; - y = (graphics->getHeight() - defaultHeight) / 2; + x = (graphics->mWidth - defaultWidth) / 2; + y = (graphics->mHeight - defaultHeight) / 2; } else if (position == ImageRect::RIGHT) { - x = graphics->getWidth() - defaultWidth; - y = (graphics->getHeight() - defaultHeight) / 2; + x = graphics->mWidth - defaultWidth; + y = (graphics->mHeight - defaultHeight) / 2; } else if (position == ImageRect::LOWER_LEFT) { - y = graphics->getHeight() - defaultHeight; + y = graphics->mHeight - defaultHeight; } else if (position == ImageRect::LOWER_CENTER) { - x = (graphics->getWidth() - defaultWidth) / 2; - y = graphics->getHeight() - defaultHeight; + x = (graphics->mWidth - defaultWidth) / 2; + y = graphics->mHeight - defaultHeight; } else if (position == ImageRect::LOWER_RIGHT) { - x = graphics->getWidth() - defaultWidth; - y = graphics->getHeight() - defaultHeight; + x = graphics->mWidth - defaultWidth; + y = graphics->mHeight - defaultHeight; } mDefaultX = x - offsetX; @@ -969,11 +969,11 @@ void Window::checkIfIsOffScreen(bool partially, bool entirely) // Look if the window is partially off-screen limits... if (partially) { - if (winDimension.x + winDimension.width > graphics->getWidth()) - winDimension.x = graphics->getWidth() - winDimension.width; + if (winDimension.x + winDimension.width > graphics->mWidth) + winDimension.x = graphics->mWidth - winDimension.width; - if (winDimension.y + winDimension.height > graphics->getHeight()) - winDimension.y = graphics->getHeight() - winDimension.height; + if (winDimension.y + winDimension.height > graphics->mHeight) + winDimension.y = graphics->mHeight - winDimension.height; setDimension(winDimension); return; @@ -981,11 +981,11 @@ void Window::checkIfIsOffScreen(bool partially, bool entirely) if (entirely) { - if (winDimension.x > graphics->getWidth()) - winDimension.x = graphics->getWidth() - winDimension.width; + if (winDimension.x > graphics->mWidth) + winDimension.x = graphics->mWidth - winDimension.width; - if (winDimension.y > graphics->getHeight()) - winDimension.y = graphics->getHeight() - winDimension.height; + if (winDimension.y > graphics->mHeight) + winDimension.y = graphics->mHeight - winDimension.height; } setDimension(winDimension); } diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index fd1582656..c62ab9bba 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -101,7 +101,7 @@ WindowMenu::WindowMenu(): if (graphics) { - setDimension(gcn::Rectangle(graphics->getWidth() - x - 3, + setDimension(gcn::Rectangle(graphics->mWidth - x - 3, 3, x - 3, h)); } @@ -347,7 +347,7 @@ void WindowMenu::updateButtons() } if (graphics) { - setDimension(gcn::Rectangle(graphics->getWidth() - x - 3, + setDimension(gcn::Rectangle(graphics->mWidth - x - 3, 3, x - 3, h)); } } diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp index e38dc8cb5..6f6217d82 100644 --- a/src/imageparticle.cpp +++ b/src/imageparticle.cpp @@ -76,9 +76,9 @@ bool ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const // Check if on screen if (screenX + mImage->mBounds.w < 0 || - screenX > graphics->getWidth() || + screenX > graphics->mWidth || screenY + mImage->mBounds.h < 0 || - screenY > graphics->getHeight()) + screenY > graphics->mHeight) { return false; } diff --git a/src/map.cpp b/src/map.cpp index 01a003f09..89ae7006e 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -540,11 +540,11 @@ void Map::update(int ticks) void Map::draw(Graphics *graphics, int scrollX, int scrollY) { // Calculate range of tiles which are on-screen - int endPixelY = graphics->getHeight() + scrollY + mTileHeight - 1; + int endPixelY = graphics->mHeight + scrollY + mTileHeight - 1; endPixelY += mMaxTileHeight - mTileHeight; int startX = scrollX / mTileWidth; int startY = scrollY / mTileHeight; - int endX = (graphics->getWidth() + scrollX + mTileWidth - 1) / mTileWidth; + int endX = (graphics->mWidth + scrollX + mTileWidth - 1) / mTileWidth; int endY = endPixelY / mTileHeight; // Make sure actors are sorted ascending by Y-coordinate @@ -568,7 +568,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY) UserPalette::WALKABLE_HIGHLIGHT)); graphics->fillRectangle(gcn::Rectangle(0, 0, - graphics->getWidth(), graphics->getHeight())); + graphics->mWidth, graphics->mHeight)); } // draw the game world @@ -649,7 +649,7 @@ void Map::drawCollision(Graphics *graphics, int scrollX, int scrollY, int endPixelY = graphics->getHeight() + scrollY + mTileHeight - 1; int startX = scrollX / mTileWidth; int startY = scrollY / mTileHeight; - int endX = (graphics->getWidth() + scrollX + mTileWidth - 1) / mTileWidth; + int endX = (graphics->mWidth + scrollX + mTileWidth - 1) / mTileWidth; int endY = endPixelY / mTileHeight; if (startX < 0) startX = 0; @@ -807,7 +807,7 @@ void Map::drawAmbientLayers(Graphics *graphics, LayerType type, for (std::vector<AmbientLayer*>::iterator i = layers->begin(); i != layers->end(); ++i) { - (*i)->draw(graphics, graphics->getWidth(), graphics->getHeight()); + (*i)->draw(graphics, graphics->mWidth, graphics->mHeight); // Detail 1: only one overlay, higher: all overlays if (detail == 1) diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp index 09a235e59..10d70c2c7 100644 --- a/src/resources/ambientlayer.cpp +++ b/src/resources/ambientlayer.cpp @@ -41,16 +41,16 @@ AmbientLayer::AmbientLayer(Image *img, float parallax, if (keepRatio && !mImage->useOpenGL() /*&& defaultScreenWidth != 0 && defaultScreenHeight != 0*/ - && graphics->getWidth() != defaultScreenWidth - && graphics->getHeight() != defaultScreenHeight) + && graphics->mWidth != defaultScreenWidth + && graphics->mHeight != defaultScreenHeight) { // Rescale the overlay to keep the ratio as if we were on // the default resolution... Image *rescaledOverlay = ResourceManager::getInstance()-> getRescaled(mImage, static_cast<int>(mImage->mBounds.w) - / defaultScreenWidth * graphics->getWidth(), + / defaultScreenWidth * graphics->mWidth, static_cast<int>(mImage->mBounds.h) - / defaultScreenHeight * graphics->getHeight()); + / defaultScreenHeight * graphics->mHeight); if (rescaledOverlay) mImage = rescaledOverlay; @@ -117,8 +117,8 @@ void AmbientLayer::draw(Graphics *graphics, int x, int y) static_cast<int>(-mPosY), x + static_cast<int>(mPosX), y + static_cast<int>(mPosY), static_cast<int>(mImage->mBounds.w) - / defaultScreenWidth * graphics->getWidth(), + / defaultScreenWidth * graphics->mWidth, static_cast<int>(mImage->mBounds.h) / defaultScreenHeight - * graphics->getHeight()); + * graphics->mHeight); } } |