From d5736f3a5ef6fe9af69138ce5ce047ca3f784307 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Sun, 1 Mar 2015 22:04:20 -0500 Subject: [PATCH 1/2] Fix #1954, part 1 --- src/graphics/2dutils.cpp | 14 +++-- src/graphics/irr_driver.cpp | 3 ++ src/graphics/irr_driver.hpp | 2 + src/graphics/post_processing.cpp | 6 +-- src/graphics/render.cpp | 8 +-- src/graphics/rtts.cpp | 4 +- src/guiengine/screen.cpp | 7 ++- src/guiengine/skin.cpp | 10 ++-- src/states_screens/race_gui.cpp | 24 +++++---- src/states_screens/race_gui_base.cpp | 62 +++++++++++------------ src/states_screens/race_gui_overworld.cpp | 36 ++++++------- 11 files changed, 90 insertions(+), 86 deletions(-) diff --git a/src/graphics/2dutils.cpp b/src/graphics/2dutils.cpp index 55421cc22..537ff43b8 100644 --- a/src/graphics/2dutils.cpp +++ b/src/graphics/2dutils.cpp @@ -65,10 +65,9 @@ float &tex_width, float &tex_height, float &tex_center_pos_x, float &tex_center_pos_y ) { - core::dimension2d frame_size = - irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); + core::dimension2d frame_size = irr_driver->getActualScreenSize(); const int screen_w = frame_size.Width; - const int screen_h = frame_size.Height; + const int screen_h = frame_size.Height; center_pos_x = float(destRect.UpperLeftCorner.X + destRect.LowerRightCorner.X); center_pos_x /= screen_w; center_pos_x -= 1.; @@ -137,7 +136,7 @@ void draw2DImage(const video::ITexture* texture, const core::rect& destRect return; glEnable(GL_SCISSOR_TEST); - const core::dimension2d& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); + const core::dimension2d& renderTargetSize = irr_driver->getActualScreenSize(); glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y, clipRect->getWidth(), clipRect->getHeight()); } @@ -226,7 +225,7 @@ void draw2DImage(const video::ITexture* texture, const core::rect& destRect return; glEnable(GL_SCISSOR_TEST); - const core::dimension2d& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); + const core::dimension2d& renderTargetSize = irr_driver->getActualScreenSize(); glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y, clipRect->getWidth(), clipRect->getHeight()); } @@ -288,8 +287,7 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect& position, return; } - core::dimension2d frame_size = - irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); + core::dimension2d frame_size = irr_driver->getActualScreenSize(); const int screen_w = frame_size.Width; const int screen_h = frame_size.Height; float center_pos_x = float(position.UpperLeftCorner.X + position.LowerRightCorner.X); @@ -319,7 +317,7 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect& position, return; glEnable(GL_SCISSOR_TEST); - const core::dimension2d& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); + const core::dimension2d& renderTargetSize = irr_driver->getActualScreenSize(); glScissor(clip->UpperLeftCorner.X, renderTargetSize.Height - clip->LowerRightCorner.Y, clip->getWidth(), clip->getHeight()); } diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index a209d551c..c2995d097 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -478,6 +478,9 @@ void IrrDriver::initDevice() m_gui_env = m_device->getGUIEnvironment(); m_video_driver = m_device->getVideoDriver(); m_sync = 0; + + m_actual_screen_size = m_video_driver->getCurrentRenderTargetSize(); + CVS->init(); diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index 9e6775283..5b8245773 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -211,6 +211,7 @@ private: bool m_rsm_matrix_initialized; bool m_rsm_map_available; core::vector2df m_current_screen_size; + core::dimension2du m_actual_screen_size; /** Additional details to be shown in case that a texture is not found. * This is used to specify details like: "while loading kart '...'" */ @@ -684,6 +685,7 @@ public: const core::matrix4 &getProjViewMatrix() const { return m_ProjViewMatrix; } const core::matrix4 &getInvProjViewMatrix() const { return m_InvProjViewMatrix; } const core::vector2df &getCurrentScreenSize() const { return m_current_screen_size; } + const core::dimension2du getActualScreenSize() const { return m_actual_screen_size; } // ------------------------------------------------------------------------ float getSSAORadius() const { diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 5a9ea07ea..80266a818 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -98,11 +98,11 @@ void PostProcessing::reset() const core::recti &vp = Camera::getCamera(i)->getViewport(); // Map viewport to [-1,1] x [-1,1]. First define the coordinates // left, right, top, bottom: - float right = vp.LowerRightCorner.X < UserConfigParams::m_width + float right = vp.LowerRightCorner.X < irr_driver->getActualScreenSize().Width ? 0.0f : 1.0f; float left = vp.UpperLeftCorner.X > 0.0f ? 0.0f : -1.0f; float top = vp.UpperLeftCorner.Y > 0.0f ? 0.0f : 1.0f; - float bottom = vp.LowerRightCorner.Y < UserConfigParams::m_height + float bottom = vp.LowerRightCorner.Y < irr_driver->getActualScreenSize().Height ? 0.0f : -1.0f; // Use left etc to define 4 vertices on which the rendered screen @@ -672,7 +672,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo // Fade to quarter irr_driver->getFBO(FBO_QUARTER1).Bind(); - glViewport(0, 0, UserConfigParams::m_width / 4, UserConfigParams::m_height / 4); + glViewport(0, 0, irr_driver->getActualScreenSize().Width / 4, irr_driver->getActualScreenSize().Height / 4); renderGodFade(out_fbo->getRTT()[0], col); // Blur diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index e08ba70a1..e1fab4cf7 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -282,8 +282,8 @@ void IrrDriver::renderGLSL(float dt) // Use full screen size float tmp[2]; - tmp[0] = float(UserConfigParams::m_width); - tmp[1] = float(UserConfigParams::m_height); + tmp[0] = float(m_actual_screen_size.Width); + tmp[1] = float(m_actual_screen_size.Height); glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO); glBufferSubData(GL_UNIFORM_BUFFER, (16 * 9) * sizeof(float), 2 * sizeof(float), tmp); @@ -294,8 +294,8 @@ void IrrDriver::renderGLSL(float dt) // Set the viewport back to the full screen for race gui m_video_driver->setViewPort(core::recti(0, 0, - UserConfigParams::m_width, - UserConfigParams::m_height)); + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height)); for(unsigned int i=0; igetPostProcessing()->render(camera, false); // reset - glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height); + glViewport(0, 0, + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height); irr_driver->setRTT(NULL); glBindFramebuffer(GL_FRAMEBUFFER, 0); diff --git a/src/guiengine/screen.cpp b/src/guiengine/screen.cpp index 29706ee0e..7f4064b84 100644 --- a/src/guiengine/screen.cpp +++ b/src/guiengine/screen.cpp @@ -19,6 +19,7 @@ #include "guiengine/screen.hpp" #include "io/file_manager.hpp" +#include "graphics/irr_driver.hpp" #include "guiengine/engine.hpp" #include "guiengine/layout_manager.hpp" #include "guiengine/modaldialog.hpp" @@ -234,16 +235,14 @@ void Screen::manualRemoveWidget(Widget* w) /** \brief Implementing method from AbstractTopLevelContainer */ int Screen::getWidth() { - core::dimension2d frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize(); - return frame_size.Width; + return irr_driver->getActualScreenSize().Width; } // ----------------------------------------------------------------------------- /** \brief Implementing method from AbstractTopLevelContainer */ int Screen::getHeight() { - core::dimension2d frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize(); - return frame_size.Height; + return irr_driver->getActualScreenSize().Height; } // ----------------------------------------------------------------------------- diff --git a/src/guiengine/skin.cpp b/src/guiengine/skin.cpp index ad77c23b8..f948ea28d 100644 --- a/src/guiengine/skin.cpp +++ b/src/guiengine/skin.cpp @@ -346,8 +346,7 @@ void Skin::drawBgImage() source_area = core::recti(0, 0, texture_w, texture_h); - core::dimension2d frame_size = - GUIEngine::getDriver()->getCurrentRenderTargetSize(); + core::dimension2d frame_size = irr_driver->getActualScreenSize(); const int screen_w = frame_size.Width; const int screen_h = frame_size.Height; @@ -971,7 +970,7 @@ void Skin::drawRibbonChild(const core::recti &rect, Widget* widget, // automatically guess from position on-screen if tabs go up or down const bool vertical_flip = (unsigned int)rect.UpperLeftCorner.Y < - GUIEngine::getDriver()->getCurrentRenderTargetSize().Height/2; + irr_driver->getActualScreenSize().Height / 2; params->m_vertical_flip = vertical_flip; core::recti rect2 = rect; @@ -2254,9 +2253,8 @@ void Skin::drawBGFadeColor() SColor color = SkinConfig::m_colors["dialog_background::neutral"]; if (m_dialog_size < 1.0f) color.setAlpha( (unsigned int)(color.getAlpha()*m_dialog_size )); - GL32_draw2DRectangle(color, - core::recti(position2d< s32 >(0,0), - GUIEngine::getDriver()->getCurrentRenderTargetSize()) ); + GL32_draw2DRectangle(color, core::recti(position2d< s32 >(0,0), + irr_driver->getActualScreenSize())); } // drawBGFadeColor // ----------------------------------------------------------------------------- diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index 1784a36bd..ad5143cd7 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -80,7 +80,7 @@ RaceGUI::RaceGUI() // special case : when 3 players play, use available 4th space for such things if (race_manager->getNumLocalPlayers() == 3) { - m_map_left = UserConfigParams::m_width - m_map_width; + m_map_left = irr_driver->getActualScreenSize().Width - m_map_width; } m_is_tutorial = (race_manager->getTrackName() == "tutorial"); @@ -148,10 +148,10 @@ void RaceGUI::renderGlobal(float dt) { static video::SColor black = video::SColor(255,0,0,0); GL32_draw2DRectangle(black, - core::rect(UserConfigParams::m_width/2, - UserConfigParams::m_height/2, - UserConfigParams::m_width, - UserConfigParams::m_height)); + core::rect(irr_driver->getActualScreenSize().Width/2, + irr_driver->getActualScreenSize().Height/2, + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height)); } World *world = World::getWorld(); @@ -319,13 +319,13 @@ void RaceGUI::drawGlobalTimer() } } - core::rect pos(UserConfigParams::m_width - dist_from_right, 10, - UserConfigParams::m_width , 50); + core::rect pos(irr_driver->getActualScreenSize().Width - dist_from_right, 10, + irr_driver->getActualScreenSize().Width , 50); // special case : when 3 players play, use available 4th space for such things if (race_manager->getNumLocalPlayers() == 3) { - pos += core::vector2d(0, UserConfigParams::m_height/2); + pos += core::vector2d(0, irr_driver->getActualScreenSize().Height/2); } gui::ScalableFont* font = (use_digit_font ? GUIEngine::getHighresDigitFont() : GUIEngine::getFont()); @@ -348,8 +348,8 @@ void RaceGUI::drawGlobalMiniMap() const video::ITexture *old_rtt_mini_map = world->getTrack()->getOldRttMiniMap(); const FrameBuffer* new_rtt_mini_map = world->getTrack()->getNewRttMiniMap(); - int upper_y = UserConfigParams::m_height - m_map_bottom - m_map_height; - int lower_y = UserConfigParams::m_height - m_map_bottom; + int upper_y = irr_driver->getActualScreenSize().Height - m_map_bottom - m_map_height; + int lower_y = irr_driver->getActualScreenSize().Height - m_map_bottom; core::rect dest(m_map_left, upper_y, m_map_left + m_map_width, lower_y); @@ -723,6 +723,8 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart, meter_texture->getOriginalSize()); draw2DImage(meter_texture, meter_pos, meter_texture_coords, NULL, NULL, true); + // TODO: temporary workaround, shouldn't have to use + // draw2DVertexPrimitiveList to render a simple rectangle const float speed = kart->getSpeed(); @@ -830,7 +832,7 @@ void RaceGUI::drawLap(const AbstractKart* kart, // move the lap/rank display down a little bit so that it is // displayed under the time. if(viewport.UpperLeftCorner.Y==0 && - viewport.LowerRightCorner.X==UserConfigParams::m_width && + viewport.LowerRightCorner.X==irr_driver->getActualScreenSize().Width && race_manager->getNumPlayers()!=3) pos.UpperLeftCorner.Y += m_font_height; pos.LowerRightCorner.Y = viewport.LowerRightCorner.Y+20; diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index f8d7f2108..db54885ae 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -542,24 +542,24 @@ void RaceGUIBase::drawGlobalMusicDescription() thetext_composer += mi->getComposer().c_str(); textWidth2 = font->getDimension(thetext_composer.c_str()).Width; } - const int max_text_size = (int)(UserConfigParams::m_width*2.0f/3.0f); + const int max_text_size = (int)(irr_driver->getActualScreenSize().Width*2.0f/3.0f); if (textWidth > max_text_size) textWidth = max_text_size; if (textWidth2 > max_text_size) textWidth2 = max_text_size; const int ICON_SIZE = 64; - const int y = UserConfigParams::m_height - 80; + const int y = irr_driver->getActualScreenSize().Height - 80; // the 20 is an arbitrary space left between the note icon and the text - const int noteX = (UserConfigParams::m_width / 2) + const int noteX = (irr_driver->getActualScreenSize().Width / 2) - std::max(textWidth, textWidth2)/2 - ICON_SIZE/2 - 20; const int noteY = y; // the 20 is an arbitrary space left between the note icon and the text - const int textXFrom = (UserConfigParams::m_width / 2) + const int textXFrom = (irr_driver->getActualScreenSize().Width / 2) - std::max(textWidth, textWidth2)/2 + 20; - const int textXTo = (UserConfigParams::m_width / 2) + const int textXTo = (irr_driver->getActualScreenSize().Width / 2) + std::max(textWidth, textWidth2)/2 + 20; // ---- Draw "by" text - const int text_y = (int)(UserConfigParams::m_height - 80*(resize3) + const int text_y = (int)(irr_driver->getActualScreenSize().Height - 80*(resize3) + 40*(1-resize)); static const video::SColor white = video::SColor(255, 255, 255, 255); @@ -598,10 +598,10 @@ void RaceGUIBase::drawGlobalMusicDescription() void RaceGUIBase::drawGlobalGoal() { static video::SColor color = video::SColor(255, 255, 255, 255); - core::rect pos(UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1, - UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1); + core::rect pos(irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1, + irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1); gui::IGUIFont* font = GUIEngine::getTitleFont(); font->draw(m_string_goal.c_str(), pos, color, true, true); } @@ -615,10 +615,10 @@ void RaceGUIBase::drawGlobalReadySetGo() case WorldStatus::READY_PHASE: { static video::SColor color = video::SColor(255, 255, 255, 255); - core::rect pos(UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1, - UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1); + core::rect pos(irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1, + irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1); gui::IGUIFont* font = GUIEngine::getTitleFont(); font->draw(m_string_ready.c_str(), pos, color, true, true); } @@ -626,10 +626,10 @@ void RaceGUIBase::drawGlobalReadySetGo() case WorldStatus::SET_PHASE: { static video::SColor color = video::SColor(255, 255, 255, 255); - core::rect pos(UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1, - UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1); + core::rect pos(irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1, + irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1); gui::IGUIFont* font = GUIEngine::getTitleFont(); font->draw(m_string_set.c_str(), pos, color, true, true); } @@ -637,10 +637,10 @@ void RaceGUIBase::drawGlobalReadySetGo() case WorldStatus::GO_PHASE: { static video::SColor color = video::SColor(255, 255, 255, 255); - core::rect pos(UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1, - UserConfigParams::m_width>>1, - UserConfigParams::m_height>>1); + core::rect pos(irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1, + irr_driver->getActualScreenSize().Width>>1, + irr_driver->getActualScreenSize().Height>>1); //gui::IGUIFont* font = irr_driver->getRaceFont(); gui::IGUIFont* font = GUIEngine::getTitleFont(); @@ -670,20 +670,20 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin) int x_base = 10; int y_base = 20; - unsigned int y_space = UserConfigParams::m_height - bottom_margin - y_base; + unsigned int y_space = irr_driver->getActualScreenSize().Height - bottom_margin - y_base; // Special case : when 3 players play, use 4th window to display such stuff if (race_manager->getNumLocalPlayers() == 3) { - x_base = UserConfigParams::m_width/2 + x_base; - y_base = UserConfigParams::m_height/2 + y_base; - y_space = UserConfigParams::m_height - y_base; + x_base = irr_driver->getActualScreenSize().Width/2 + x_base; + y_base = irr_driver->getActualScreenSize().Height/2 + y_base; + y_space = irr_driver->getActualScreenSize().Height - y_base; } // -2 because that's the spacing further on int ICON_PLAYER_WIDTH = y_space / race_manager->getNumberOfKarts() - 2; - int icon_width_max = (int)(50*(UserConfigParams::m_width/800.0f)); - int icon_width_min = (int)(35*(UserConfigParams::m_height/600.0f)); + int icon_width_max = (int)(50*(irr_driver->getActualScreenSize().Width/800.0f)); + int icon_width_min = (int)(35*(irr_driver->getActualScreenSize().Height/600.0f)); if (icon_width_min > icon_width_max) { int icon_width_tmp = icon_width_max; @@ -696,7 +696,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin) if (ICON_PLAYER_WIDTH < icon_width_min) ICON_PLAYER_WIDTH = icon_width_min; // TODO: Is this absolute treshold necessary? - if(UserConfigParams::m_height<600) + if(irr_driver->getActualScreenSize().Height<600) { ICON_PLAYER_WIDTH = 35; } @@ -730,9 +730,9 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin) const unsigned int kart_amount = world->getNumKarts(); //where is the limit to hide last icons - int y_icons_limit=UserConfigParams::m_height-bottom_margin-ICON_PLAYER_WIDTH; + int y_icons_limit=irr_driver->getActualScreenSize().Height-bottom_margin-ICON_PLAYER_WIDTH; if (race_manager->getNumLocalPlayers() == 3) - y_icons_limit=UserConfigParams::m_height-ICON_WIDTH; + y_icons_limit=irr_driver->getActualScreenSize().Height-ICON_WIDTH; world->getKartsDisplayInfo(&m_kart_display_infos); diff --git a/src/states_screens/race_gui_overworld.cpp b/src/states_screens/race_gui_overworld.cpp index 6b88045d7..a77839be4 100644 --- a/src/states_screens/race_gui_overworld.cpp +++ b/src/states_screens/race_gui_overworld.cpp @@ -84,7 +84,7 @@ RaceGUIOverworld::RaceGUIOverworld() m_map_height = (int)(250.0f * scaling); m_map_left = 20; - m_map_bottom = UserConfigParams::m_height-10; + m_map_bottom = irr_driver->getActualScreenSize().Height-10; // Minimap is also rendered bigger via OpenGL, so find power-of-two again const int map_texture = 2 << ((int) ceil(1.0 + log(128.0 * scaling))); @@ -95,7 +95,7 @@ RaceGUIOverworld::RaceGUIOverworld() // special case : when 3 players play, use available 4th space for such things if (race_manager->getNumLocalPlayers() == 3) { - m_map_left = UserConfigParams::m_width - m_map_width; + m_map_left = irr_driver->getActualScreenSize().Width - m_map_width; } m_speed_meter_icon = material_manager->getMaterial("speedback.png"); @@ -146,10 +146,10 @@ void RaceGUIOverworld::renderGlobal(float dt) { static video::SColor black = video::SColor(255,0,0,0); GL32_draw2DRectangle(black, - core::rect(UserConfigParams::m_width/2, - UserConfigParams::m_height/2, - UserConfigParams::m_width, - UserConfigParams::m_height)); + core::rect(irr_driver->getActualScreenSize().Width/2, + irr_driver->getActualScreenSize().Height/2, + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height)); } World *world = World::getWorld(); @@ -216,14 +216,14 @@ void RaceGUIOverworld::drawTrophyPoints() int dist_from_right = 10 + m_trophy_points_width; - core::rect pos(UserConfigParams::m_width - dist_from_right, 10, - UserConfigParams::m_width , 50); + core::rect pos(irr_driver->getActualScreenSize().Width - dist_from_right, 10, + irr_driver->getActualScreenSize().Width , 50); gui::ScalableFont* font = GUIEngine::getFont(); bool vcenter = true; - const int size = UserConfigParams::m_width/20; + const int size = irr_driver->getActualScreenSize().Width/20; core::rect dest(size, pos.UpperLeftCorner.Y, size*2, pos.UpperLeftCorner.Y + size); core::rect source(core::position2di(0, 0), m_trophy3->getSize()); @@ -435,7 +435,7 @@ void RaceGUIOverworld::drawGlobalMiniMap() // ---- Draw nearby challenge if any core::rect pos(15, 10, - 15 + UserConfigParams::m_width/2, + 15 + irr_driver->getActualScreenSize().Width/2, 10 + GUIEngine::getTitleFontHeight()); m_close_to_a_challenge = false; @@ -456,9 +456,9 @@ void RaceGUIOverworld::drawGlobalMiniMap() false, true /* vcenter */, NULL); core::rect pos2(0, - UserConfigParams::m_height - GUIEngine::getFontHeight()*2, - UserConfigParams::m_width, - UserConfigParams::m_height); + irr_driver->getActualScreenSize().Height - GUIEngine::getFontHeight()*2, + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height); GUIEngine::getOutlineFont()->draw(_("Press fire to play the tutorial"), pos2, video::SColor(255,255,150,60), true, true /* vcenter */, NULL); @@ -495,7 +495,7 @@ void RaceGUIOverworld::drawGlobalMiniMap() core::rect pos(15, 20 + GUIEngine::getTitleFontHeight(), - 15 + UserConfigParams::m_width/2, + 15 + irr_driver->getActualScreenSize().Width/2, 20 + 2*GUIEngine::getTitleFontHeight()); //just below GP name @@ -520,15 +520,15 @@ void RaceGUIOverworld::drawGlobalMiniMap() } pos.UpperLeftCorner.Y += GUIEngine::getTitleFontHeight(); - pos.LowerRightCorner.Y = UserConfigParams::m_height; + pos.LowerRightCorner.Y = irr_driver->getActualScreenSize().Height; GUIEngine::getFont()->draw(challenge->getChallengeDescription().c_str(), pos, video::SColor(255,255,255,255), false, false /* vcenter */, NULL); core::rect pos2(0, - UserConfigParams::m_height - GUIEngine::getFontHeight()*2, - UserConfigParams::m_width, - UserConfigParams::m_height); + irr_driver->getActualScreenSize().Height - GUIEngine::getFontHeight()*2, + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height); GUIEngine::getOutlineFont()->draw(_("Press fire to start the challenge"), pos2, video::SColor(255,255,150,60), true, true /* vcenter */, NULL); From 48d5567b3f87c9cbc0c62ff62f1c44cce1e20517 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Sun, 1 Mar 2015 21:50:54 -0500 Subject: [PATCH 2/2] Fix #1954, part 2 --- src/graphics/camera.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index 06d477186..465950bc1 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -164,21 +164,21 @@ void Camera::readEndCamera(const XMLNode &root) */ void Camera::setupCamera() { - m_aspect = (float)(UserConfigParams::m_width)/UserConfigParams::m_height; + m_aspect = (float)(irr_driver->getActualScreenSize().Width)/irr_driver->getActualScreenSize().Height; switch(race_manager->getNumLocalPlayers()) { case 1: m_viewport = core::recti(0, 0, - UserConfigParams::m_width, - UserConfigParams::m_height); + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height); m_scaling = core::vector2df(1.0f, 1.0f); m_fov = DEGREE_TO_RAD*75.0f; break; case 2: m_viewport = core::recti(0, m_index==0 ? 0 - : UserConfigParams::m_height>>1, - UserConfigParams::m_width, - m_index==0 ? UserConfigParams::m_height>>1 - : UserConfigParams::m_height); + : irr_driver->getActualScreenSize().Height>>1, + irr_driver->getActualScreenSize().Width, + m_index==0 ? irr_driver->getActualScreenSize().Height>>1 + : irr_driver->getActualScreenSize().Height); m_scaling = core::vector2df(1.0f, 0.5f); m_aspect *= 2.0f; m_fov = DEGREE_TO_RAD*65.0f; @@ -188,19 +188,19 @@ void Camera::setupCamera() if(m_index<2) { m_viewport = core::recti(m_index==0 ? 0 - : UserConfigParams::m_width>>1, + : irr_driver->getActualScreenSize().Width>>1, 0, - m_index==0 ? UserConfigParams::m_width>>1 - : UserConfigParams::m_width, - UserConfigParams::m_height>>1); + m_index==0 ? irr_driver->getActualScreenSize().Width>>1 + : irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height>>1); m_scaling = core::vector2df(0.5f, 0.5f); m_fov = DEGREE_TO_RAD*50.0f; } else { - m_viewport = core::recti(0, UserConfigParams::m_height>>1, - UserConfigParams::m_width, - UserConfigParams::m_height); + m_viewport = core::recti(0, irr_driver->getActualScreenSize().Height>>1, + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height); m_scaling = core::vector2df(1.0f, 0.5f); m_fov = DEGREE_TO_RAD*65.0f; m_aspect *= 2.0f; @@ -208,10 +208,10 @@ void Camera::setupCamera() break;*/ case 4: { // g++ 4.3 whines about the variables in switch/case if not {}-wrapped (???) - const int x1 = (m_index%2==0 ? 0 : UserConfigParams::m_width>>1); - const int y1 = (m_index<2 ? 0 : UserConfigParams::m_height>>1); - const int x2 = (m_index%2==0 ? UserConfigParams::m_width>>1 : UserConfigParams::m_width); - const int y2 = (m_index<2 ? UserConfigParams::m_height>>1 : UserConfigParams::m_height); + const int x1 = (m_index%2==0 ? 0 : irr_driver->getActualScreenSize().Width>>1); + const int y1 = (m_index<2 ? 0 : irr_driver->getActualScreenSize().Height>>1); + const int x2 = (m_index%2==0 ? irr_driver->getActualScreenSize().Width>>1 : irr_driver->getActualScreenSize().Width); + const int y2 = (m_index<2 ? irr_driver->getActualScreenSize().Height>>1 : irr_driver->getActualScreenSize().Height); m_viewport = core::recti(x1, y1, x2, y2); m_scaling = core::vector2df(0.5f, 0.5f); m_fov = DEGREE_TO_RAD*50.0f; @@ -222,8 +222,8 @@ void Camera::setupCamera() Log::warn("Camera", "Incorrect number of players: '%d' - assuming 1.", race_manager->getNumLocalPlayers()); m_viewport = core::recti(0, 0, - UserConfigParams::m_width, - UserConfigParams::m_height); + irr_driver->getActualScreenSize().Width, + irr_driver->getActualScreenSize().Height); m_scaling = core::vector2df(1.0f, 1.0f); m_fov = DEGREE_TO_RAD*75.0f; break;