Merge branch '1954-fix'

This commit is contained in:
Marianne Gagnon 2015-03-03 18:58:26 -05:00
commit c8ae3d117a
12 changed files with 110 additions and 106 deletions

View File

@ -65,10 +65,9 @@ float &tex_width, float &tex_height,
float &tex_center_pos_x, float &tex_center_pos_y float &tex_center_pos_x, float &tex_center_pos_y
) )
{ {
core::dimension2d<u32> frame_size = core::dimension2d<u32> frame_size = irr_driver->getActualScreenSize();
irr_driver->getVideoDriver()->getCurrentRenderTargetSize();
const int screen_w = frame_size.Width; 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 = float(destRect.UpperLeftCorner.X + destRect.LowerRightCorner.X);
center_pos_x /= screen_w; center_pos_x /= screen_w;
center_pos_x -= 1.; center_pos_x -= 1.;
@ -137,7 +136,7 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
return; return;
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
const core::dimension2d<u32>& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); const core::dimension2d<u32>& renderTargetSize = irr_driver->getActualScreenSize();
glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y, glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y,
clipRect->getWidth(), clipRect->getHeight()); clipRect->getWidth(), clipRect->getHeight());
} }
@ -226,7 +225,7 @@ void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect
return; return;
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
const core::dimension2d<u32>& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); const core::dimension2d<u32>& renderTargetSize = irr_driver->getActualScreenSize();
glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y, glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y,
clipRect->getWidth(), clipRect->getHeight()); clipRect->getWidth(), clipRect->getHeight());
} }
@ -288,8 +287,7 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
return; return;
} }
core::dimension2d<u32> frame_size = core::dimension2d<u32> frame_size = irr_driver->getActualScreenSize();
irr_driver->getVideoDriver()->getCurrentRenderTargetSize();
const int screen_w = frame_size.Width; const int screen_w = frame_size.Width;
const int screen_h = frame_size.Height; const int screen_h = frame_size.Height;
float center_pos_x = float(position.UpperLeftCorner.X + position.LowerRightCorner.X); float center_pos_x = float(position.UpperLeftCorner.X + position.LowerRightCorner.X);
@ -319,7 +317,7 @@ void GL32_draw2DRectangle(video::SColor color, const core::rect<s32>& position,
return; return;
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
const core::dimension2d<u32>& renderTargetSize = irr_driver->getVideoDriver()->getCurrentRenderTargetSize(); const core::dimension2d<u32>& renderTargetSize = irr_driver->getActualScreenSize();
glScissor(clip->UpperLeftCorner.X, renderTargetSize.Height - clip->LowerRightCorner.Y, glScissor(clip->UpperLeftCorner.X, renderTargetSize.Height - clip->LowerRightCorner.Y,
clip->getWidth(), clip->getHeight()); clip->getWidth(), clip->getHeight());
} }

View File

@ -164,21 +164,21 @@ void Camera::readEndCamera(const XMLNode &root)
*/ */
void Camera::setupCamera() 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()) switch(race_manager->getNumLocalPlayers())
{ {
case 1: m_viewport = core::recti(0, 0, case 1: m_viewport = core::recti(0, 0,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height); irr_driver->getActualScreenSize().Height);
m_scaling = core::vector2df(1.0f, 1.0f); m_scaling = core::vector2df(1.0f, 1.0f);
m_fov = DEGREE_TO_RAD*75.0f; m_fov = DEGREE_TO_RAD*75.0f;
break; break;
case 2: m_viewport = core::recti(0, case 2: m_viewport = core::recti(0,
m_index==0 ? 0 m_index==0 ? 0
: UserConfigParams::m_height>>1, : irr_driver->getActualScreenSize().Height>>1,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
m_index==0 ? UserConfigParams::m_height>>1 m_index==0 ? irr_driver->getActualScreenSize().Height>>1
: UserConfigParams::m_height); : irr_driver->getActualScreenSize().Height);
m_scaling = core::vector2df(1.0f, 0.5f); m_scaling = core::vector2df(1.0f, 0.5f);
m_aspect *= 2.0f; m_aspect *= 2.0f;
m_fov = DEGREE_TO_RAD*65.0f; m_fov = DEGREE_TO_RAD*65.0f;
@ -188,19 +188,19 @@ void Camera::setupCamera()
if(m_index<2) if(m_index<2)
{ {
m_viewport = core::recti(m_index==0 ? 0 m_viewport = core::recti(m_index==0 ? 0
: UserConfigParams::m_width>>1, : irr_driver->getActualScreenSize().Width>>1,
0, 0,
m_index==0 ? UserConfigParams::m_width>>1 m_index==0 ? irr_driver->getActualScreenSize().Width>>1
: UserConfigParams::m_width, : irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height>>1); irr_driver->getActualScreenSize().Height>>1);
m_scaling = core::vector2df(0.5f, 0.5f); m_scaling = core::vector2df(0.5f, 0.5f);
m_fov = DEGREE_TO_RAD*50.0f; m_fov = DEGREE_TO_RAD*50.0f;
} }
else else
{ {
m_viewport = core::recti(0, UserConfigParams::m_height>>1, m_viewport = core::recti(0, irr_driver->getActualScreenSize().Height>>1,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height); irr_driver->getActualScreenSize().Height);
m_scaling = core::vector2df(1.0f, 0.5f); m_scaling = core::vector2df(1.0f, 0.5f);
m_fov = DEGREE_TO_RAD*65.0f; m_fov = DEGREE_TO_RAD*65.0f;
m_aspect *= 2.0f; m_aspect *= 2.0f;
@ -208,10 +208,10 @@ void Camera::setupCamera()
break;*/ break;*/
case 4: case 4:
{ // g++ 4.3 whines about the variables in switch/case if not {}-wrapped (???) { // 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 x1 = (m_index%2==0 ? 0 : irr_driver->getActualScreenSize().Width>>1);
const int y1 = (m_index<2 ? 0 : UserConfigParams::m_height>>1); const int y1 = (m_index<2 ? 0 : irr_driver->getActualScreenSize().Height>>1);
const int x2 = (m_index%2==0 ? UserConfigParams::m_width>>1 : UserConfigParams::m_width); const int x2 = (m_index%2==0 ? irr_driver->getActualScreenSize().Width>>1 : irr_driver->getActualScreenSize().Width);
const int y2 = (m_index<2 ? UserConfigParams::m_height>>1 : UserConfigParams::m_height); const int y2 = (m_index<2 ? irr_driver->getActualScreenSize().Height>>1 : irr_driver->getActualScreenSize().Height);
m_viewport = core::recti(x1, y1, x2, y2); m_viewport = core::recti(x1, y1, x2, y2);
m_scaling = core::vector2df(0.5f, 0.5f); m_scaling = core::vector2df(0.5f, 0.5f);
m_fov = DEGREE_TO_RAD*50.0f; m_fov = DEGREE_TO_RAD*50.0f;
@ -222,8 +222,8 @@ void Camera::setupCamera()
Log::warn("Camera", "Incorrect number of players: '%d' - assuming 1.", Log::warn("Camera", "Incorrect number of players: '%d' - assuming 1.",
race_manager->getNumLocalPlayers()); race_manager->getNumLocalPlayers());
m_viewport = core::recti(0, 0, m_viewport = core::recti(0, 0,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height); irr_driver->getActualScreenSize().Height);
m_scaling = core::vector2df(1.0f, 1.0f); m_scaling = core::vector2df(1.0f, 1.0f);
m_fov = DEGREE_TO_RAD*75.0f; m_fov = DEGREE_TO_RAD*75.0f;
break; break;

View File

@ -478,6 +478,9 @@ void IrrDriver::initDevice()
m_gui_env = m_device->getGUIEnvironment(); m_gui_env = m_device->getGUIEnvironment();
m_video_driver = m_device->getVideoDriver(); m_video_driver = m_device->getVideoDriver();
m_sync = 0; m_sync = 0;
m_actual_screen_size = m_video_driver->getCurrentRenderTargetSize();
CVS->init(); CVS->init();

View File

@ -211,6 +211,7 @@ private:
bool m_rsm_matrix_initialized; bool m_rsm_matrix_initialized;
bool m_rsm_map_available; bool m_rsm_map_available;
core::vector2df m_current_screen_size; 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. /** Additional details to be shown in case that a texture is not found.
* This is used to specify details like: "while loading kart '...'" */ * 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 &getProjViewMatrix() const { return m_ProjViewMatrix; }
const core::matrix4 &getInvProjViewMatrix() const { return m_InvProjViewMatrix; } const core::matrix4 &getInvProjViewMatrix() const { return m_InvProjViewMatrix; }
const core::vector2df &getCurrentScreenSize() const { return m_current_screen_size; } const core::vector2df &getCurrentScreenSize() const { return m_current_screen_size; }
const core::dimension2du getActualScreenSize() const { return m_actual_screen_size; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
float getSSAORadius() const float getSSAORadius() const
{ {

View File

@ -98,11 +98,11 @@ void PostProcessing::reset()
const core::recti &vp = Camera::getCamera(i)->getViewport(); const core::recti &vp = Camera::getCamera(i)->getViewport();
// Map viewport to [-1,1] x [-1,1]. First define the coordinates // Map viewport to [-1,1] x [-1,1]. First define the coordinates
// left, right, top, bottom: // 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; ? 0.0f : 1.0f;
float left = vp.UpperLeftCorner.X > 0.0f ? 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 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; ? 0.0f : -1.0f;
// Use left etc to define 4 vertices on which the rendered screen // 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 // Fade to quarter
irr_driver->getFBO(FBO_QUARTER1).Bind(); 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); renderGodFade(out_fbo->getRTT()[0], col);
// Blur // Blur

View File

@ -282,8 +282,8 @@ void IrrDriver::renderGLSL(float dt)
// Use full screen size // Use full screen size
float tmp[2]; float tmp[2];
tmp[0] = float(UserConfigParams::m_width); tmp[0] = float(m_actual_screen_size.Width);
tmp[1] = float(UserConfigParams::m_height); tmp[1] = float(m_actual_screen_size.Height);
glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO); glBindBuffer(GL_UNIFORM_BUFFER, SharedObject::ViewProjectionMatrixesUBO);
glBufferSubData(GL_UNIFORM_BUFFER, (16 * 9) * sizeof(float), 2 * sizeof(float), tmp); 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 // Set the viewport back to the full screen for race gui
m_video_driver->setViewPort(core::recti(0, 0, m_video_driver->setViewPort(core::recti(0, 0,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height)); irr_driver->getActualScreenSize().Height));
for(unsigned int i=0; i<Camera::getNumCameras(); i++) for(unsigned int i=0; i<Camera::getNumCameras(); i++)
{ {

View File

@ -310,7 +310,9 @@ FrameBuffer* RTT::render(scene::ICameraSceneNode* camera, float dt)
FrameBuffer* frame_buffer = irr_driver->getPostProcessing()->render(camera, false); FrameBuffer* frame_buffer = irr_driver->getPostProcessing()->render(camera, false);
// reset // 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); irr_driver->setRTT(NULL);
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);

View File

@ -19,6 +19,7 @@
#include "guiengine/screen.hpp" #include "guiengine/screen.hpp"
#include "io/file_manager.hpp" #include "io/file_manager.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp" #include "guiengine/engine.hpp"
#include "guiengine/layout_manager.hpp" #include "guiengine/layout_manager.hpp"
#include "guiengine/modaldialog.hpp" #include "guiengine/modaldialog.hpp"
@ -234,16 +235,14 @@ void Screen::manualRemoveWidget(Widget* w)
/** \brief Implementing method from AbstractTopLevelContainer */ /** \brief Implementing method from AbstractTopLevelContainer */
int Screen::getWidth() int Screen::getWidth()
{ {
core::dimension2d<u32> frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize(); return irr_driver->getActualScreenSize().Width;
return frame_size.Width;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/** \brief Implementing method from AbstractTopLevelContainer */ /** \brief Implementing method from AbstractTopLevelContainer */
int Screen::getHeight() int Screen::getHeight()
{ {
core::dimension2d<u32> frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize(); return irr_driver->getActualScreenSize().Height;
return frame_size.Height;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -346,8 +346,7 @@ void Skin::drawBgImage()
source_area = core::recti(0, 0, texture_w, texture_h); source_area = core::recti(0, 0, texture_w, texture_h);
core::dimension2d<u32> frame_size = core::dimension2d<u32> frame_size = irr_driver->getActualScreenSize();
GUIEngine::getDriver()->getCurrentRenderTargetSize();
const int screen_w = frame_size.Width; const int screen_w = frame_size.Width;
const int screen_h = frame_size.Height; 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 // automatically guess from position on-screen if tabs go up or down
const bool vertical_flip = const bool vertical_flip =
(unsigned int)rect.UpperLeftCorner.Y < (unsigned int)rect.UpperLeftCorner.Y <
GUIEngine::getDriver()->getCurrentRenderTargetSize().Height/2; irr_driver->getActualScreenSize().Height / 2;
params->m_vertical_flip = vertical_flip; params->m_vertical_flip = vertical_flip;
core::recti rect2 = rect; core::recti rect2 = rect;
@ -2254,9 +2253,8 @@ void Skin::drawBGFadeColor()
SColor color = SkinConfig::m_colors["dialog_background::neutral"]; SColor color = SkinConfig::m_colors["dialog_background::neutral"];
if (m_dialog_size < 1.0f) if (m_dialog_size < 1.0f)
color.setAlpha( (unsigned int)(color.getAlpha()*m_dialog_size )); color.setAlpha( (unsigned int)(color.getAlpha()*m_dialog_size ));
GL32_draw2DRectangle(color, GL32_draw2DRectangle(color, core::recti(position2d< s32 >(0,0),
core::recti(position2d< s32 >(0,0), irr_driver->getActualScreenSize()));
GUIEngine::getDriver()->getCurrentRenderTargetSize()) );
} // drawBGFadeColor } // drawBGFadeColor
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -80,7 +80,7 @@ RaceGUI::RaceGUI()
// special case : when 3 players play, use available 4th space for such things // special case : when 3 players play, use available 4th space for such things
if (race_manager->getNumLocalPlayers() == 3) 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"); 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); static video::SColor black = video::SColor(255,0,0,0);
GL32_draw2DRectangle(black, GL32_draw2DRectangle(black,
core::rect<s32>(UserConfigParams::m_width/2, core::rect<s32>(irr_driver->getActualScreenSize().Width/2,
UserConfigParams::m_height/2, irr_driver->getActualScreenSize().Height/2,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height)); irr_driver->getActualScreenSize().Height));
} }
World *world = World::getWorld(); World *world = World::getWorld();
@ -319,13 +319,13 @@ void RaceGUI::drawGlobalTimer()
} }
} }
core::rect<s32> pos(UserConfigParams::m_width - dist_from_right, 10, core::rect<s32> pos(irr_driver->getActualScreenSize().Width - dist_from_right, 10,
UserConfigParams::m_width , 50); irr_driver->getActualScreenSize().Width , 50);
// special case : when 3 players play, use available 4th space for such things // special case : when 3 players play, use available 4th space for such things
if (race_manager->getNumLocalPlayers() == 3) if (race_manager->getNumLocalPlayers() == 3)
{ {
pos += core::vector2d<s32>(0, UserConfigParams::m_height/2); pos += core::vector2d<s32>(0, irr_driver->getActualScreenSize().Height/2);
} }
gui::ScalableFont* font = (use_digit_font ? GUIEngine::getHighresDigitFont() : GUIEngine::getFont()); 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 video::ITexture *old_rtt_mini_map = world->getTrack()->getOldRttMiniMap();
const FrameBuffer* new_rtt_mini_map = world->getTrack()->getNewRttMiniMap(); const FrameBuffer* new_rtt_mini_map = world->getTrack()->getNewRttMiniMap();
int upper_y = UserConfigParams::m_height - m_map_bottom - m_map_height; int upper_y = irr_driver->getActualScreenSize().Height - m_map_bottom - m_map_height;
int lower_y = UserConfigParams::m_height - m_map_bottom; int lower_y = irr_driver->getActualScreenSize().Height - m_map_bottom;
core::rect<s32> dest(m_map_left, upper_y, core::rect<s32> dest(m_map_left, upper_y,
m_map_left + m_map_width, lower_y); m_map_left + m_map_width, lower_y);
@ -723,6 +723,8 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
meter_texture->getOriginalSize()); meter_texture->getOriginalSize());
draw2DImage(meter_texture, meter_pos, meter_texture_coords, NULL, draw2DImage(meter_texture, meter_pos, meter_texture_coords, NULL,
NULL, true); NULL, true);
// TODO: temporary workaround, shouldn't have to use
// draw2DVertexPrimitiveList to render a simple rectangle
const float speed = kart->getSpeed(); 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 // move the lap/rank display down a little bit so that it is
// displayed under the time. // displayed under the time.
if(viewport.UpperLeftCorner.Y==0 && if(viewport.UpperLeftCorner.Y==0 &&
viewport.LowerRightCorner.X==UserConfigParams::m_width && viewport.LowerRightCorner.X==irr_driver->getActualScreenSize().Width &&
race_manager->getNumPlayers()!=3) race_manager->getNumPlayers()!=3)
pos.UpperLeftCorner.Y += m_font_height; pos.UpperLeftCorner.Y += m_font_height;
pos.LowerRightCorner.Y = viewport.LowerRightCorner.Y+20; pos.LowerRightCorner.Y = viewport.LowerRightCorner.Y+20;

View File

@ -542,24 +542,24 @@ void RaceGUIBase::drawGlobalMusicDescription()
thetext_composer += mi->getComposer().c_str(); thetext_composer += mi->getComposer().c_str();
textWidth2 = font->getDimension(thetext_composer.c_str()).Width; 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 (textWidth > max_text_size) textWidth = max_text_size;
if (textWidth2 > max_text_size) textWidth2 = max_text_size; if (textWidth2 > max_text_size) textWidth2 = max_text_size;
const int ICON_SIZE = 64; 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 // 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; - std::max(textWidth, textWidth2)/2 - ICON_SIZE/2 - 20;
const int noteY = y; const int noteY = y;
// the 20 is an arbitrary space left between the note icon and the text // 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; - 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; + std::max(textWidth, textWidth2)/2 + 20;
// ---- Draw "by" text // ---- 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)); + 40*(1-resize));
static const video::SColor white = video::SColor(255, 255, 255, 255); static const video::SColor white = video::SColor(255, 255, 255, 255);
@ -598,10 +598,10 @@ void RaceGUIBase::drawGlobalMusicDescription()
void RaceGUIBase::drawGlobalGoal() void RaceGUIBase::drawGlobalGoal()
{ {
static video::SColor color = video::SColor(255, 255, 255, 255); static video::SColor color = video::SColor(255, 255, 255, 255);
core::rect<s32> pos(UserConfigParams::m_width>>1, core::rect<s32> pos(irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1, irr_driver->getActualScreenSize().Height>>1,
UserConfigParams::m_width>>1, irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1); irr_driver->getActualScreenSize().Height>>1);
gui::IGUIFont* font = GUIEngine::getTitleFont(); gui::IGUIFont* font = GUIEngine::getTitleFont();
font->draw(m_string_goal.c_str(), pos, color, true, true); font->draw(m_string_goal.c_str(), pos, color, true, true);
} }
@ -615,10 +615,10 @@ void RaceGUIBase::drawGlobalReadySetGo()
case WorldStatus::READY_PHASE: case WorldStatus::READY_PHASE:
{ {
static video::SColor color = video::SColor(255, 255, 255, 255); static video::SColor color = video::SColor(255, 255, 255, 255);
core::rect<s32> pos(UserConfigParams::m_width>>1, core::rect<s32> pos(irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1, irr_driver->getActualScreenSize().Height>>1,
UserConfigParams::m_width>>1, irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1); irr_driver->getActualScreenSize().Height>>1);
gui::IGUIFont* font = GUIEngine::getTitleFont(); gui::IGUIFont* font = GUIEngine::getTitleFont();
font->draw(m_string_ready.c_str(), pos, color, true, true); font->draw(m_string_ready.c_str(), pos, color, true, true);
} }
@ -626,10 +626,10 @@ void RaceGUIBase::drawGlobalReadySetGo()
case WorldStatus::SET_PHASE: case WorldStatus::SET_PHASE:
{ {
static video::SColor color = video::SColor(255, 255, 255, 255); static video::SColor color = video::SColor(255, 255, 255, 255);
core::rect<s32> pos(UserConfigParams::m_width>>1, core::rect<s32> pos(irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1, irr_driver->getActualScreenSize().Height>>1,
UserConfigParams::m_width>>1, irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1); irr_driver->getActualScreenSize().Height>>1);
gui::IGUIFont* font = GUIEngine::getTitleFont(); gui::IGUIFont* font = GUIEngine::getTitleFont();
font->draw(m_string_set.c_str(), pos, color, true, true); font->draw(m_string_set.c_str(), pos, color, true, true);
} }
@ -637,10 +637,10 @@ void RaceGUIBase::drawGlobalReadySetGo()
case WorldStatus::GO_PHASE: case WorldStatus::GO_PHASE:
{ {
static video::SColor color = video::SColor(255, 255, 255, 255); static video::SColor color = video::SColor(255, 255, 255, 255);
core::rect<s32> pos(UserConfigParams::m_width>>1, core::rect<s32> pos(irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1, irr_driver->getActualScreenSize().Height>>1,
UserConfigParams::m_width>>1, irr_driver->getActualScreenSize().Width>>1,
UserConfigParams::m_height>>1); irr_driver->getActualScreenSize().Height>>1);
//gui::IGUIFont* font = irr_driver->getRaceFont(); //gui::IGUIFont* font = irr_driver->getRaceFont();
gui::IGUIFont* font = GUIEngine::getTitleFont(); gui::IGUIFont* font = GUIEngine::getTitleFont();
@ -670,20 +670,20 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
int x_base = 10; int x_base = 10;
int y_base = 20; 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 // Special case : when 3 players play, use 4th window to display such stuff
if (race_manager->getNumLocalPlayers() == 3) if (race_manager->getNumLocalPlayers() == 3)
{ {
x_base = UserConfigParams::m_width/2 + x_base; x_base = irr_driver->getActualScreenSize().Width/2 + x_base;
y_base = UserConfigParams::m_height/2 + y_base; y_base = irr_driver->getActualScreenSize().Height/2 + y_base;
y_space = UserConfigParams::m_height - y_base; y_space = irr_driver->getActualScreenSize().Height - y_base;
} }
// -2 because that's the spacing further on // -2 because that's the spacing further on
int ICON_PLAYER_WIDTH = y_space / race_manager->getNumberOfKarts() - 2; int ICON_PLAYER_WIDTH = y_space / race_manager->getNumberOfKarts() - 2;
int icon_width_max = (int)(50*(UserConfigParams::m_width/800.0f)); int icon_width_max = (int)(50*(irr_driver->getActualScreenSize().Width/800.0f));
int icon_width_min = (int)(35*(UserConfigParams::m_height/600.0f)); int icon_width_min = (int)(35*(irr_driver->getActualScreenSize().Height/600.0f));
if (icon_width_min > icon_width_max) if (icon_width_min > icon_width_max)
{ {
int icon_width_tmp = 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; if (ICON_PLAYER_WIDTH < icon_width_min) ICON_PLAYER_WIDTH = icon_width_min;
// TODO: Is this absolute treshold necessary? // TODO: Is this absolute treshold necessary?
if(UserConfigParams::m_height<600) if(irr_driver->getActualScreenSize().Height<600)
{ {
ICON_PLAYER_WIDTH = 35; ICON_PLAYER_WIDTH = 35;
} }
@ -730,9 +730,9 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
const unsigned int kart_amount = world->getNumKarts(); const unsigned int kart_amount = world->getNumKarts();
//where is the limit to hide last icons //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) 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); world->getKartsDisplayInfo(&m_kart_display_infos);

View File

@ -84,7 +84,7 @@ RaceGUIOverworld::RaceGUIOverworld()
m_map_height = (int)(250.0f * scaling); m_map_height = (int)(250.0f * scaling);
m_map_left = 20; 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 // 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))); 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 // special case : when 3 players play, use available 4th space for such things
if (race_manager->getNumLocalPlayers() == 3) 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"); 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); static video::SColor black = video::SColor(255,0,0,0);
GL32_draw2DRectangle(black, GL32_draw2DRectangle(black,
core::rect<s32>(UserConfigParams::m_width/2, core::rect<s32>(irr_driver->getActualScreenSize().Width/2,
UserConfigParams::m_height/2, irr_driver->getActualScreenSize().Height/2,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height)); irr_driver->getActualScreenSize().Height));
} }
World *world = World::getWorld(); World *world = World::getWorld();
@ -216,14 +216,14 @@ void RaceGUIOverworld::drawTrophyPoints()
int dist_from_right = 10 + m_trophy_points_width; int dist_from_right = 10 + m_trophy_points_width;
core::rect<s32> pos(UserConfigParams::m_width - dist_from_right, 10, core::rect<s32> pos(irr_driver->getActualScreenSize().Width - dist_from_right, 10,
UserConfigParams::m_width , 50); irr_driver->getActualScreenSize().Width , 50);
gui::ScalableFont* font = GUIEngine::getFont(); gui::ScalableFont* font = GUIEngine::getFont();
bool vcenter = true; bool vcenter = true;
const int size = UserConfigParams::m_width/20; const int size = irr_driver->getActualScreenSize().Width/20;
core::rect<s32> dest(size, pos.UpperLeftCorner.Y, core::rect<s32> dest(size, pos.UpperLeftCorner.Y,
size*2, pos.UpperLeftCorner.Y + size); size*2, pos.UpperLeftCorner.Y + size);
core::rect<s32> source(core::position2di(0, 0), m_trophy3->getSize()); core::rect<s32> source(core::position2di(0, 0), m_trophy3->getSize());
@ -435,7 +435,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
// ---- Draw nearby challenge if any // ---- Draw nearby challenge if any
core::rect<s32> pos(15, core::rect<s32> pos(15,
10, 10,
15 + UserConfigParams::m_width/2, 15 + irr_driver->getActualScreenSize().Width/2,
10 + GUIEngine::getTitleFontHeight()); 10 + GUIEngine::getTitleFontHeight());
m_close_to_a_challenge = false; m_close_to_a_challenge = false;
@ -456,9 +456,9 @@ void RaceGUIOverworld::drawGlobalMiniMap()
false, true /* vcenter */, NULL); false, true /* vcenter */, NULL);
core::rect<s32> pos2(0, core::rect<s32> pos2(0,
UserConfigParams::m_height - GUIEngine::getFontHeight()*2, irr_driver->getActualScreenSize().Height - GUIEngine::getFontHeight()*2,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height); irr_driver->getActualScreenSize().Height);
GUIEngine::getOutlineFont()->draw(_("Press fire to play the tutorial"), pos2, GUIEngine::getOutlineFont()->draw(_("Press fire to play the tutorial"), pos2,
video::SColor(255,255,150,60), video::SColor(255,255,150,60),
true, true /* vcenter */, NULL); true, true /* vcenter */, NULL);
@ -495,7 +495,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
core::rect<s32> pos(15, core::rect<s32> pos(15,
20 + GUIEngine::getTitleFontHeight(), 20 + GUIEngine::getTitleFontHeight(),
15 + UserConfigParams::m_width/2, 15 + irr_driver->getActualScreenSize().Width/2,
20 + 2*GUIEngine::getTitleFontHeight()); 20 + 2*GUIEngine::getTitleFontHeight());
//just below GP name //just below GP name
@ -520,15 +520,15 @@ void RaceGUIOverworld::drawGlobalMiniMap()
} }
pos.UpperLeftCorner.Y += GUIEngine::getTitleFontHeight(); 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(), GUIEngine::getFont()->draw(challenge->getChallengeDescription().c_str(),
pos, video::SColor(255,255,255,255), pos, video::SColor(255,255,255,255),
false, false /* vcenter */, NULL); false, false /* vcenter */, NULL);
core::rect<s32> pos2(0, core::rect<s32> pos2(0,
UserConfigParams::m_height - GUIEngine::getFontHeight()*2, irr_driver->getActualScreenSize().Height - GUIEngine::getFontHeight()*2,
UserConfigParams::m_width, irr_driver->getActualScreenSize().Width,
UserConfigParams::m_height); irr_driver->getActualScreenSize().Height);
GUIEngine::getOutlineFont()->draw(_("Press fire to start the challenge"), pos2, GUIEngine::getOutlineFont()->draw(_("Press fire to start the challenge"), pos2,
video::SColor(255,255,150,60), video::SColor(255,255,150,60),
true, true /* vcenter */, NULL); true, true /* vcenter */, NULL);