diff --git a/src/guiengine/skin.cpp b/src/guiengine/skin.cpp index 1202e719f..8f52a1053 100644 --- a/src/guiengine/skin.cpp +++ b/src/guiengine/skin.cpp @@ -85,31 +85,39 @@ namespace SkinConfig node->get("areas", &areas); - BoxRenderParams newParam; - newParam.m_left_border = leftborder; - newParam.m_right_border = rightborder; - newParam.m_top_border = topborder; - newParam.m_bottom_border = bottomborder; - newParam.m_hborder_out_portion = hborder_out_portion; - newParam.m_vborder_out_portion = vborder_out_portion; - newParam.m_preserve_h_aspect_ratios = preserve_h_aspect_ratios; + BoxRenderParams new_param; + new_param.m_left_border = leftborder; + new_param.m_right_border = rightborder; + new_param.m_top_border = topborder; + new_param.m_bottom_border = bottomborder; + new_param.m_hborder_out_portion = hborder_out_portion; + new_param.m_vborder_out_portion = vborder_out_portion; + new_param.m_preserve_h_aspect_ratios = preserve_h_aspect_ratios; - // call last since it calculates coords considering all other parameters - newParam.setTexture( irr_driver->getTexture( (file_manager->getGUIDir() + "/skins/" + image).c_str() ) ); + // call last since it calculates coords considering all other + // parameters + std:: string full_path = file_manager->getGUIDir() + "/skins/" + image; + new_param.setTexture( irr_driver->getTexture(full_path) ); if (areas.size() > 0) { - newParam.areas = 0; - if(areas.find("body") != std::string::npos) newParam.areas |= BoxRenderParams::BODY; - if(areas.find("top") != std::string::npos) newParam.areas |= BoxRenderParams::TOP; - if(areas.find("bottom") != std::string::npos) newParam.areas |= BoxRenderParams::BOTTOM; - if(areas.find("left") != std::string::npos) newParam.areas |= BoxRenderParams::LEFT; - if(areas.find("right") != std::string::npos) newParam.areas |= BoxRenderParams::RIGHT; + new_param.areas = 0; + if(areas.find("body") != std::string::npos) + new_param.areas |= BoxRenderParams::BODY; + if(areas.find("top") != std::string::npos) + new_param.areas |= BoxRenderParams::TOP; + if(areas.find("bottom") != std::string::npos) + new_param.areas |= BoxRenderParams::BOTTOM; + if(areas.find("left") != std::string::npos) + new_param.areas |= BoxRenderParams::LEFT; + if(areas.find("right") != std::string::npos) + new_param.areas |= BoxRenderParams::RIGHT; } - m_render_params[type+"::"+state] = newParam; - } - + m_render_params[type+"::"+state] = new_param; + } // parseElement + + // ------------------------------------------------------------------------ static void parseColor(const XMLNode* node) { std::string type; @@ -133,8 +141,8 @@ namespace SkinConfig SColor color = SColor(a, r, g, b); m_colors[type+"::"+state] = color; - } - + } // parseColor + // ------------------------------------------------------------------------ /** * \brief loads skin information from a STK skin file * \throw std::runtime_error if file cannot be read @@ -144,7 +152,8 @@ namespace SkinConfig XMLNode* root = file_manager->createXMLTree(file); if(!root) { - std::cerr << "Could not read XML file " << file.c_str() << std::endl; + std::cerr << "Could not read XML file " << file.c_str() + << std::endl; throw std::runtime_error("Invalid skin file"); } @@ -163,14 +172,16 @@ namespace SkinConfig } else { - std::cerr << "Unknown node in XML file : " << node->getName().c_str() << std::endl; + std::cerr << "Unknown node in XML file : " << node->getName() + << std::endl; } }// nend for delete root; - } -}; + } // loadFromFile +}; // SkinConfig +// ============================================================================ #if 0 #pragma mark - #endif @@ -190,7 +201,9 @@ BoxRenderParams::BoxRenderParams() areas = BODY | LEFT | RIGHT | TOP | BOTTOM; m_vertical_flip = false; m_y_flip_set = false; -} +} // BoxRenderParams + +// ---------------------------------------------------------------------------- void BoxRenderParams::setTexture(ITexture* image) { if (image == NULL) @@ -201,7 +214,8 @@ void BoxRenderParams::setTexture(ITexture* image) m_image = image; /* - The source texture is split this way to allow for a stretchable center and borders that don't stretch : + The source texture is split this way to allow for a stretchable center + and borders that don't stretch : +----+--------------------+----+ | | | | @@ -225,18 +239,20 @@ void BoxRenderParams::setTexture(ITexture* image) const int dx = texture_w - m_right_border; const int dy = texture_h - m_bottom_border; - m_source_area_left = core::rect(0, ay, cx, cy); - m_source_area_center = core::rect(ax, ay, dx, dy); - m_source_area_right = core::rect(bx, m_top_border, texture_w, dy); + m_source_area_left = core::recti(0, ay, cx, cy); + m_source_area_center = core::recti(ax, ay, dx, dy); + m_source_area_right = core::recti(bx, m_top_border, texture_w, dy); - m_source_area_top = core::rect(ax, 0, bx, by); - m_source_area_bottom = core::rect(cx, cy, dx, texture_h); + m_source_area_top = core::recti(ax, 0, bx, by); + m_source_area_bottom = core::recti(cx, cy, dx, texture_h); - m_source_area_top_left = core::rect(0, 0, ax, ay); - m_source_area_top_right = core::rect(bx, 0, texture_w, m_top_border); - m_source_area_bottom_left = core::rect(0, cy, cx, texture_h); - m_source_area_bottom_right = core::rect(dx, dy, texture_w, texture_h); -} + m_source_area_top_left = core::recti(0, 0, ax, ay); + m_source_area_top_right = core::recti(bx, 0, texture_w, m_top_border); + m_source_area_bottom_left = core::recti(0, cy, cx, texture_h); + m_source_area_bottom_right = core::recti(dx, dy, texture_w, texture_h); +} // setTexture + +// ---------------------------------------------------------------------------- void BoxRenderParams::calculateYFlipIfNeeded() { if (m_y_flip_set) return; @@ -262,8 +278,9 @@ X##_yflip.LowerRightCorner.Y = y1;} m_y_flip_set = true; -} +} // calculateYFlipIfNeeded +// ---------------------------------------------------------------------------- #if 0 #pragma mark - #endif @@ -298,34 +315,39 @@ Skin::Skin(IGUISkin* fallback_skin) m_dialog = false; m_dialog_size = 0.0f; -} +} // Skin +// ---------------------------------------------------------------------------- Skin::~Skin() { m_fallback_skin->drop(); -} +} // ~Skin +// ---------------------------------------------------------------------------- void Skin::drawBgImage() { // ---- background image // on one end, making these static is not too clean. // on another end, these variables are really only used locally, - // and making them static avoids doing the same stupid computations every frame - static core::rect dest; - static core::rect source_area; + // and making them static avoids doing the same stupid computations + // every frame + static core::recti dest; + static core::recti source_area; if(bg_image == NULL) { int texture_w, texture_h; - bg_image = SkinConfig::m_render_params["background::neutral"].getImage(); + bg_image = + SkinConfig::m_render_params["background::neutral"].getImage(); assert(bg_image != NULL); texture_w = bg_image->getSize().Width; texture_h = bg_image->getSize().Height; - source_area = core::rect(0, 0, texture_w, texture_h); + source_area = core::recti(0, 0, texture_w, texture_h); - core::dimension2d frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize(); + core::dimension2d frame_size = + GUIEngine::getDriver()->getCurrentRenderTargetSize(); const int screen_w = frame_size.Width; const int screen_h = frame_size.Height; @@ -340,21 +362,29 @@ void Skin::drawBgImage() const int clipped_x_space = (texture_w - screen_w); - dest = core::rect(-clipped_x_space/2, 0, screen_w+clipped_x_space/2, texture_h); + dest = core::recti(-clipped_x_space/2, 0, + screen_w+clipped_x_space/2, texture_h); } irr_driver->getVideoDriver()->enableMaterial2D(); - GUIEngine::getDriver()->draw2DImage(bg_image, dest, source_area, 0 /* no clipping */, 0, false /* alpha */); + GUIEngine::getDriver()->draw2DImage(bg_image, dest, source_area, + /* no clipping */0, /*color*/ 0, + /*alpha*/false); irr_driver->getVideoDriver()->enableMaterial2D(false); -} +} // drawBgImage -void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rect< s32 > &dest, - BoxRenderParams& params, bool deactivated, - const core::rect* clipRect) +// ---------------------------------------------------------------------------- +void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, + const core::recti &dest, + BoxRenderParams& params, + bool deactivated, + const core::recti* clipRect) { // check if widget moved. if so, recalculate coords - if (w->m_skin_x != dest.UpperLeftCorner.X || w->m_skin_y != dest.UpperLeftCorner.Y || - w->m_skin_w != dest.getWidth() || w->m_skin_h != dest.getHeight()) + if (w->m_skin_x != dest.UpperLeftCorner.X || + w->m_skin_y != dest.UpperLeftCorner.Y || + w->m_skin_w != dest.getWidth() || + w->m_skin_h != dest.getHeight() ) { w->m_skin_dest_areas_inited = false; w->m_skin_dest_areas_yflip_inited = false; @@ -379,9 +409,10 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec const int texture_h = source->getSize().Height; /* - The dest area is split this way. Borders can go a bit beyond the given area so - components inside don't go over the borders - (how much it exceeds horizontally is specified in 'hborder_out_portion'. vertically is always the totality) + The dest area is split this way. Borders can go a bit beyond the given + area so components inside don't go over the borders + (how much it exceeds horizontally is specified in 'hborder_out_portion'. + vertically is always the totality) a----b--------------------c----+ | | | | @@ -401,40 +432,53 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec w->m_skin_dest_x2 = dest.LowerRightCorner.X; w->m_skin_dest_y2 = dest.LowerRightCorner.Y; - //const float xscale = (float)(dest_x2-dest_x)/texture_w; - const float yscale = (float)(w->m_skin_dest_y2 - w->m_skin_dest_y)/texture_h; + const float yscale = + (float)(w->m_skin_dest_y2 - w->m_skin_dest_y)/texture_h; int dest_left_border, dest_right_border; // scale and keep aspect ratio if (preserve_h_aspect_ratios) { - dest_left_border = (int)(left_border * (w->m_skin_dest_y2 - w->m_skin_dest_y) / texture_h ); - dest_right_border = (int)(right_border * (w->m_skin_dest_y2 - w->m_skin_dest_y) / texture_h); + dest_left_border = (int)( left_border + * (w->m_skin_dest_y2 - w->m_skin_dest_y) + / texture_h); + dest_right_border = (int)(right_border + * (w->m_skin_dest_y2 - w->m_skin_dest_y) + / texture_h); } else { - dest_left_border = (int)(left_border *std::min(yscale, 1.0)); - dest_right_border = (int)(right_border *std::min(yscale, 1.0)); + dest_left_border = + (int)(left_border *std::min(yscale, 1.0)); + dest_right_border = + (int)(right_border *std::min(yscale, 1.0)); } - int dest_top_border = (int)(top_border *std::min(yscale, 1.0)); - int dest_bottom_border = (int)(bottom_border*std::min(yscale, 1.0)); + int dest_top_border = + (int)(top_border *std::min(yscale, 1.0)); + int dest_bottom_border = + (int)(bottom_border*std::min(yscale, 1.0)); const float hborder_in_portion = 1 - hborder_out_portion; const float vborder_in_portion = 1 - vborder_out_portion; - const int ax = (int)(w->m_skin_dest_x - dest_left_border * hborder_out_portion); - const int ay = (int)(w->m_skin_dest_y - dest_top_border * vborder_out_portion); + const int ax = (int)(w->m_skin_dest_x + - dest_left_border * hborder_out_portion); + const int ay = (int)(w->m_skin_dest_y + - dest_top_border * vborder_out_portion); - const int bx = (int)(w->m_skin_dest_x + dest_left_border*hborder_in_portion); + const int bx = (int)(w->m_skin_dest_x + + dest_left_border*hborder_in_portion); const int by = ay; - const int cx = (int)(w->m_skin_dest_x2 - dest_right_border*hborder_in_portion); + const int cx = (int)(w->m_skin_dest_x2 + - dest_right_border*hborder_in_portion); const int cy = ay; const int dx = ax; - const int dy = (int)(w->m_skin_dest_y + dest_top_border*vborder_in_portion); + const int dy = (int)(w->m_skin_dest_y + + dest_top_border*vborder_in_portion); const int ex = bx; const int ey = dy; @@ -442,11 +486,13 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec const int fx = cx; const int fy = dy; - const int gx = (int)(w->m_skin_dest_x2 + dest_right_border*hborder_out_portion); + const int gx = (int)(w->m_skin_dest_x2 + + dest_right_border*hborder_out_portion); const int gy = dy; const int hx = ax; - const int hy = (int)(w->m_skin_dest_y2 - dest_bottom_border*vborder_in_portion); + const int hy = (int)(w->m_skin_dest_y2 + - dest_bottom_border*vborder_in_portion); const int ix = bx; const int iy = hy; @@ -458,7 +504,8 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec const int ky = hy; const int lx = bx; - const int ly = (int)(w->m_skin_dest_y2 + dest_bottom_border*vborder_out_portion); + const int ly = (int)(w->m_skin_dest_y2 + + dest_bottom_border*vborder_out_portion); const int mx = cx; const int my = ly; @@ -466,17 +513,17 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec const int nx = gx; const int ny = ly; - w->m_skin_dest_area_left = core::rect(dx, dy, ix, iy); - w->m_skin_dest_area_center = core::rect(ex, ey, jx, jy); - w->m_skin_dest_area_right = core::rect(fx, fy, kx, ky); + w->m_skin_dest_area_left = core::recti(dx, dy, ix, iy); + w->m_skin_dest_area_center = core::recti(ex, ey, jx, jy); + w->m_skin_dest_area_right = core::recti(fx, fy, kx, ky); - w->m_skin_dest_area_top = core::rect(bx, by, fx, fy); - w->m_skin_dest_area_bottom = core::rect(ix, iy, mx, my); + w->m_skin_dest_area_top = core::recti(bx, by, fx, fy); + w->m_skin_dest_area_bottom = core::recti(ix, iy, mx, my); - w->m_skin_dest_area_top_left = core::rect(ax, ay, ex, ey); - w->m_skin_dest_area_top_right = core::rect(cx, cy, gx, gy); - w->m_skin_dest_area_bottom_left = core::rect(hx, hy, lx, ly); - w->m_skin_dest_area_bottom_right = core::rect(jx, jy, nx, ny); + w->m_skin_dest_area_top_left = core::recti(ax, ay, ex, ey); + w->m_skin_dest_area_top_right = core::recti(cx, cy, gx, gy); + w->m_skin_dest_area_bottom_left = core::recti(hx, hy, lx, ly); + w->m_skin_dest_area_bottom_right = core::recti(jx, jy, nx, ny); w->m_skin_dest_areas_inited = true; } @@ -485,11 +532,14 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec { if (!w->m_skin_dest_areas_yflip_inited) { -#define FLIP_Y( X ) { const int y1 = X.UpperLeftCorner.Y - w->m_skin_dest_y; \ +#define FLIP_Y( X ) { const int y1 = X.UpperLeftCorner.Y \ + - w->m_skin_dest_y; \ const int y2 = X.LowerRightCorner.Y - w->m_skin_dest_y; \ X##_yflip = X; \ -X##_yflip.UpperLeftCorner.Y = w->m_skin_dest_y + (w->m_skin_dest_y2 - w->m_skin_dest_y) - y2;\ -X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + (w->m_skin_dest_y2 - w->m_skin_dest_y) - y1;} +X##_yflip.UpperLeftCorner.Y = w->m_skin_dest_y + \ + (w->m_skin_dest_y2 - w->m_skin_dest_y) - y2;\ +X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + \ + (w->m_skin_dest_y2 - w->m_skin_dest_y) - y1;} FLIP_Y(w->m_skin_dest_area_left) FLIP_Y(w->m_skin_dest_area_center) @@ -511,37 +561,39 @@ X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + (w->m_skin_dest_y2 - w->m_skin } #define GET_AREA( X ) X = (vertical_flip ? params.X##_yflip : params.X) - core::rect& GET_AREA(m_source_area_left); - core::rect& GET_AREA(m_source_area_center); - core::rect& GET_AREA(m_source_area_right); + core::recti& GET_AREA(m_source_area_left); + core::recti& GET_AREA(m_source_area_center); + core::recti& GET_AREA(m_source_area_right); - core::rect& GET_AREA(m_source_area_top); - core::rect& GET_AREA(m_source_area_bottom); + core::recti& GET_AREA(m_source_area_top); + core::recti& GET_AREA(m_source_area_bottom); - core::rect& GET_AREA(m_source_area_top_left); - core::rect& GET_AREA(m_source_area_top_right); - core::rect& GET_AREA(m_source_area_bottom_left); - core::rect& GET_AREA(m_source_area_bottom_right); + core::recti& GET_AREA(m_source_area_top_left); + core::recti& GET_AREA(m_source_area_top_right); + core::recti& GET_AREA(m_source_area_bottom_left); + core::recti& GET_AREA(m_source_area_bottom_right); #undef GET_AREA -#define GET_AREA( X ) X = (vertical_flip ? w->m_skin_##X##_yflip : w->m_skin_##X) - core::rect& GET_AREA(dest_area_left); - core::rect& GET_AREA(dest_area_center); - core::rect& GET_AREA(dest_area_right); +#define GET_AREA( X ) X = (vertical_flip ? w->m_skin_##X##_yflip \ + : w->m_skin_##X) + core::recti& GET_AREA(dest_area_left); + core::recti& GET_AREA(dest_area_center); + core::recti& GET_AREA(dest_area_right); - core::rect& GET_AREA(dest_area_top); - core::rect& GET_AREA(dest_area_bottom); + core::recti& GET_AREA(dest_area_top); + core::recti& GET_AREA(dest_area_bottom); - core::rect& GET_AREA(dest_area_top_left); - core::rect& GET_AREA(dest_area_top_right); - core::rect& GET_AREA(dest_area_bottom_left); - core::rect& GET_AREA(dest_area_bottom_right); + core::recti& GET_AREA(dest_area_top_left); + core::recti& GET_AREA(dest_area_top_right); + core::recti& GET_AREA(dest_area_bottom_left); + core::recti& GET_AREA(dest_area_bottom_right); #undef GET_AREA SColor* colorptr = NULL; // create a color object - if ( (w->m_skin_r != -1 && w->m_skin_g != -1 && w->m_skin_b != -1) || ID_DEBUG || deactivated) + if ( (w->m_skin_r != -1 && w->m_skin_g != -1 && w->m_skin_b != -1) || + ID_DEBUG || deactivated) { SColor thecolor(255, w->m_skin_r, w->m_skin_g, w->m_skin_b); colorptr = new SColor[4](); @@ -562,52 +614,67 @@ X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + (w->m_skin_dest_y2 - w->m_skin if ((areas & BoxRenderParams::LEFT) != 0) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_left, m_source_area_left, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_left, + m_source_area_left, clipRect, + colorptr, true /* alpha */); } if ((areas & BoxRenderParams::BODY) != 0) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_center, m_source_area_center, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_center, + m_source_area_center, clipRect, + colorptr, true /* alpha */); } if ((areas & BoxRenderParams::RIGHT) != 0) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_right, m_source_area_right, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_right, + m_source_area_right, clipRect, + colorptr, true /* alpha */); } if ((areas & BoxRenderParams::TOP) != 0) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_top, m_source_area_top, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_top, + m_source_area_top, clipRect, + colorptr, true /* alpha */); } if ((areas & BoxRenderParams::BOTTOM) != 0) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom, m_source_area_bottom, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom, + m_source_area_bottom, clipRect, + colorptr, true /* alpha */); } - if ( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::TOP) != 0) ) + if ( ((areas & BoxRenderParams::LEFT) != 0) && + ((areas & BoxRenderParams::TOP ) != 0) ) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_top_left, m_source_area_top_left, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_top_left, + m_source_area_top_left, clipRect, + colorptr, true /* alpha */); } - if ( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::TOP) != 0) ) + if ( ((areas & BoxRenderParams::RIGHT) != 0) && + ((areas & BoxRenderParams::TOP ) != 0) ) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_top_right, m_source_area_top_right, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_top_right, + m_source_area_top_right, clipRect, + colorptr, true /* alpha */); } - if ( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) ) + if ( ((areas & BoxRenderParams::LEFT ) != 0) && + ((areas & BoxRenderParams::BOTTOM) != 0) ) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_left, m_source_area_bottom_left, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_left, + m_source_area_bottom_left, + clipRect, colorptr, + /*alpha*/true ); } - if ( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) ) + if ( ((areas & BoxRenderParams::RIGHT ) != 0) && + ((areas & BoxRenderParams::BOTTOM) != 0) ) { - GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_right, m_source_area_bottom_right, - clipRect, colorptr, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_right, + m_source_area_bottom_right, + clipRect, colorptr, + /*alpha*/true ); } if (colorptr != NULL) @@ -615,111 +682,152 @@ X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + (w->m_skin_dest_y2 - w->m_skin delete[] colorptr; } -} +} // drawBoxFromStretchableTexture +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (focus for other players is not supported) + * @param focused whether this element is focus by the master player (focus + * for other players is not supported) */ -void Skin::drawButton(Widget* w, const core::rect< s32 > &rect, const bool pressed, const bool focused) +void Skin::drawButton(Widget* w, const core::recti &rect, + const bool pressed, const bool focused) { // if within an appearing dialog, grow - if (m_dialog && m_dialog_size < 1.0f && w->m_parent != NULL && w->m_parent->getType() == gui::EGUIET_WINDOW) + if (m_dialog && m_dialog_size < 1.0f && w->m_parent != NULL && + w->m_parent->getType() == gui::EGUIET_WINDOW) { - core::rect< s32 > sized_rect = rect; - core::position2d center = core::position2d(irr_driver->getFrameSize()/2); + core::recti sized_rect = rect; + core::position2d center = + core::position2d(irr_driver->getFrameSize()/2); const float texture_size = sin(m_dialog_size*M_PI*0.5f); - sized_rect.UpperLeftCorner.X = center.X + (int)(((int)rect.UpperLeftCorner.X - (int)center.X)*texture_size); - sized_rect.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size); - sized_rect.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size); - sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size); + sized_rect.UpperLeftCorner.X = + center.X + (int)(((int)rect.UpperLeftCorner.X + - (int)center.X)*texture_size); + sized_rect.UpperLeftCorner.Y = + center.Y + (int)(((int)rect.UpperLeftCorner.Y + - (int)center.Y)*texture_size); + sized_rect.LowerRightCorner.X = + center.X + (int)(((int)rect.LowerRightCorner.X + - (int)center.X)*texture_size); + sized_rect.LowerRightCorner.Y = + center.Y + (int)(((int)rect.LowerRightCorner.Y + - (int)center.Y)*texture_size); if (focused) { - drawBoxFromStretchableTexture(w, sized_rect, SkinConfig::m_render_params["button::focused"], - w->m_deactivated); + drawBoxFromStretchableTexture(w, sized_rect, + SkinConfig::m_render_params["button::focused"], + w->m_deactivated); } else { - drawBoxFromStretchableTexture(w, sized_rect, SkinConfig::m_render_params["button::neutral"], - w->m_deactivated); + drawBoxFromStretchableTexture(w, sized_rect, + SkinConfig::m_render_params["button::neutral"], + w->m_deactivated); } } - else + else // not within an appearing dialog { if (focused) { - drawBoxFromStretchableTexture(w, rect, SkinConfig::m_render_params["button::focused"], - w->m_deactivated); + drawBoxFromStretchableTexture(w, rect, + SkinConfig::m_render_params["button::focused"], + w->m_deactivated); } else { - drawBoxFromStretchableTexture(w, rect, SkinConfig::m_render_params["button::neutral"], - w->m_deactivated); - } - } -} + drawBoxFromStretchableTexture(w, rect, + SkinConfig::m_render_params["button::neutral"], + w->m_deactivated); + } // if not focused + } // not within an appearing dialog +} // drawButton + +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (focus for other players is not supported) + * @param focused whether this element is focus by the master player (focus + * for other players is not supported) */ -void Skin::drawProgress(Widget* w, const core::rect< s32 > &rect, const bool pressed, const bool focused) +void Skin::drawProgress(Widget* w, const core::recti &rect, + const bool pressed, const bool focused) { - core::rect< s32 > sized_rect = rect; + core::recti sized_rect = rect; // if within an appearing dialog, grow - if (m_dialog && m_dialog_size < 1.0f && w->m_parent != NULL && w->m_parent->getType() == gui::EGUIET_WINDOW) + if (m_dialog && m_dialog_size < 1.0f && w->m_parent != NULL && + w->m_parent->getType() == gui::EGUIET_WINDOW ) { - core::position2d center = core::position2d(irr_driver->getFrameSize()/2); + core::position2d center = + core::position2d(irr_driver->getFrameSize()/2); const float texture_size = sin(m_dialog_size*M_PI*0.5f); - sized_rect.UpperLeftCorner.X = center.X + (int)(((int)rect.UpperLeftCorner.X - (int)center.X)*texture_size); - sized_rect.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size); - sized_rect.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size); - sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size); + sized_rect.UpperLeftCorner.X = + center.X + (int)(((int)rect.UpperLeftCorner.X + - (int)center.X)*texture_size); + sized_rect.UpperLeftCorner.Y = + center.Y + (int)(((int)rect.UpperLeftCorner.Y + - (int)center.Y)*texture_size); + sized_rect.LowerRightCorner.X = + center.X + (int)(((int)rect.LowerRightCorner.X + - (int)center.X)*texture_size); + sized_rect.LowerRightCorner.Y = + center.Y + (int)(((int)rect.LowerRightCorner.Y + - (int)center.Y)*texture_size); - drawBoxFromStretchableTexture(w, sized_rect, SkinConfig::m_render_params["progress::neutral"], - w->m_deactivated); + drawBoxFromStretchableTexture(w, sized_rect, + SkinConfig::m_render_params["progress::neutral"], + w->m_deactivated); } else { ProgressBarWidget * progress = (ProgressBarWidget*)w; - drawBoxFromStretchableTexture(w, rect, SkinConfig::m_render_params["progress::neutral"], - w->m_deactivated); - //the " - 10" is a dirty hack to avoid to have the right arrow before the left one + drawBoxFromStretchableTexture(w, rect, + SkinConfig::m_render_params["progress::neutral"], + w->m_deactivated); + //the " - 10" is a dirty hack to avoid to have the right arrow + // before the left one //FIXME - core::rect rect2 = rect; - rect2.LowerRightCorner.X -= (rect.getWidth() - 10) - progress->getValue()*rect.getWidth()/100; + core::recti rect2 = rect; + rect2.LowerRightCorner.X -= (rect.getWidth() - 10) + - progress->getValue()*rect.getWidth()/100; drawBoxFromStretchableTexture(w, rect2, - SkinConfig::m_render_params["progress::fill"], - w->m_deactivated); + SkinConfig::m_render_params["progress::fill"], + w->m_deactivated); #if 0 - GUIEngine::getDriver()->draw2DImage(SkinConfig::m_render_params["progress::fill"].getImage(), sized_rect, - core::rect(0,0,progress->m_w, progress->m_h), - 0 /* no clipping */, colors, true); + GUIEngine::getDriver()->draw2DImage( + SkinConfig::m_render_params["progress::fill"].getImage(), + sized_rect, core::recti(0,0,progress->m_w, progress->m_h), + 0 /* no clipping */, colors, true); #endif } -} +} // drawProgress +// ---------------------------------------------------------------------------- SColor Skin::getColor(const std::string &name) { return SkinConfig::m_colors[name]; -} +} // getColor -void Skin::drawRibbon(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused) +// ---------------------------------------------------------------------------- +void Skin::drawRibbon(const core::recti &rect, Widget* widget, + const bool pressed, bool focused) { -} +} // drawRibbon +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (whether the widget is - * focused for other players is automatically determined) + * @param focused whether this element is focus by the master player (whether + * the widget is focused for other players is automatically determined) * FIXME: ugly to pass some focuses through parameter and others not xD */ -void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused) +void Skin::drawRibbonChild(const core::recti &rect, Widget* widget, + const bool pressed, bool focused) { - // for now, when this kind of widget is disabled, just hide it. we can change that behaviour if - // we ever need to... + // for now, when this kind of widget is disabled, just hide it. we can + // change that behaviour if we ever need to... //if (widget->m_deactivated) return; bool mark_selected = widget->isSelected(PLAYER_ID_GAME_MASTER); @@ -728,10 +836,12 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const IGUIElement* focusedElem = NULL; if (GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) != NULL) { - focusedElem = GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER)->getIrrlichtElement(); + focusedElem = GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) + ->getIrrlichtElement(); } - const bool parent_focused = (focusedElem == widget->m_event_handler->m_element); + const bool parent_focused = + (focusedElem == widget->m_event_handler->m_element); RibbonWidget* parentRibbon = (RibbonWidget*)widget->m_event_handler; RibbonType type = parentRibbon->getRibbonType(); @@ -739,13 +849,16 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const /* tab-bar ribbons */ if (type == RIBBON_TABS) { - video::SMaterial& material2D = irr_driver->getVideoDriver()->getMaterial2D(); + video::SMaterial& material2D = + irr_driver->getVideoDriver()->getMaterial2D(); for (unsigned int n=0; ngetDevice()->getCursorControl()->getPosition()); + const bool mouseIn = rect.isPointInside(irr_driver->getDevice() + ->getCursorControl() + ->getPosition() ); BoxRenderParams* params; @@ -760,10 +873,12 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const // 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; + const bool vertical_flip = + (unsigned int)rect.UpperLeftCorner.Y < + GUIEngine::getDriver()->getCurrentRenderTargetSize().Height/2; params->m_vertical_flip = vertical_flip; - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; if (mark_selected) { // selected tab should be slighlty bigger than others @@ -771,7 +886,9 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const else rect2.LowerRightCorner.Y += 10; } - drawBoxFromStretchableTexture(widget, rect2, *params, parentRibbon->m_deactivated || widget->m_deactivated); + drawBoxFromStretchableTexture(widget, rect2, *params, + parentRibbon->m_deactivated || + widget->m_deactivated); for (unsigned int n=0; n &rect, Widget* widget, const { bool use_glow = true; - if (widget->m_event_handler != NULL && widget->m_event_handler->m_properties[PROP_SQUARE] == "true") use_glow = false; - if (widget->m_event_handler != NULL && widget->m_event_handler->m_event_handler != NULL && - widget->m_event_handler->m_event_handler->m_properties[PROP_SQUARE] == "true") use_glow = false; + if (widget->m_event_handler != NULL && + widget->m_event_handler->m_properties[PROP_SQUARE] == "true") + use_glow = false; + if (widget->m_event_handler != NULL && + widget->m_event_handler->m_event_handler != NULL && + widget->m_event_handler->m_event_handler + ->m_properties[PROP_SQUARE] == "true") + use_glow = false; /* in combo ribbons, always show selection */ RibbonWidget* parentRibbonWidget = NULL; - if (widget->m_event_handler != NULL && widget->m_event_handler->m_type == WTYPE_RIBBON) + if (widget->m_event_handler != NULL && + widget->m_event_handler->m_type == WTYPE_RIBBON) { - parentRibbonWidget = dynamic_cast(widget->m_event_handler); - if(parentRibbonWidget->getRibbonType() == RIBBON_COMBO) always_show_selection = true; + parentRibbonWidget = + dynamic_cast(widget->m_event_handler); + if(parentRibbonWidget->getRibbonType() == RIBBON_COMBO) + always_show_selection = true; } - const bool mark_focused = focused || (parent_focused && parentRibbonWidget != NULL && parentRibbonWidget->m_mouse_focus == widget) || - (mark_selected && !always_show_selection && parent_focused); + const bool mark_focused = + focused || (parent_focused && parentRibbonWidget != NULL && + parentRibbonWidget->m_mouse_focus == widget) || + (mark_selected && !always_show_selection && + parent_focused); /* draw "selection bubble" if relevant */ if (always_show_selection && mark_selected) { - ITexture* tex_bubble = SkinConfig::m_render_params["selectionHalo::neutral"].getImage(); + ITexture* tex_bubble = + SkinConfig::m_render_params["selectionHalo::neutral"] + .getImage(); const int texture_w = tex_bubble->getSize().Width; const int texture_h = tex_bubble->getSize().Height; const float aspectRatio = (float)texture_w / (float)texture_h; - core::rect source_area = core::rect(0, 0, texture_w, texture_h); + core::recti source_area = core::recti(0, 0, + texture_w,texture_h); - const float outgrow = 0.35f; // make slightly bigger than the icon it's on + const float outgrow = 0.35f; // make slightly bigger than the + // icon it's on const int rectHeight = int(rect.getHeight() * (1.0f + outgrow)); const int rectWidth = int(rectHeight * aspectRatio); const int x_gap = (rect.getWidth() - rectWidth)/2; const int y_shift_up = int((rectHeight - rect.getHeight()) / 2.0f); - core::rect< s32 > rect2( position2d< s32 >(rect.UpperLeftCorner.X + x_gap, - rect.UpperLeftCorner.Y - y_shift_up), - dimension2d< s32 >(rectWidth, rectHeight) ); + core::position2di pos(rect.UpperLeftCorner.X + x_gap, + rect.UpperLeftCorner.Y - y_shift_up); + core::recti rect2(pos, + core::dimension2di(rectWidth, rectHeight) ); if (widget->m_deactivated || ID_DEBUG) { @@ -826,17 +959,22 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const SColor(100,255,255,255), SColor(100,255,255,255), SColor(100,255,255,255) }; - GUIEngine::getDriver()->draw2DImage(tex_bubble, rect2, source_area, - 0 /* no clipping */, colors, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(tex_bubble, rect2, + source_area, + 0 /* no clipping */, + colors, true /* alpha */); } else { - GUIEngine::getDriver()->draw2DImage(tex_bubble, rect2, source_area, - 0 /* no clipping */, 0, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(tex_bubble, rect2, + source_area, + 0 /* no clipping */, 0, + true /* alpha */); } } - // if multiple player selected the same ribbon item, we need to know to make it visible + // if multiple player selected the same ribbon item, we need to know + // to make it visible int nPlayersOnThisItem = 0; if (mark_focused) @@ -844,7 +982,8 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const if (use_glow) { // don't mark filler items as focused - if (widget->m_properties[PROP_ID] == RibbonWidget::NO_ITEM_ID) return; + if (widget->m_properties[PROP_ID] == RibbonWidget::NO_ITEM_ID) + return; int grow = 45; static float glow_effect = 0; @@ -857,23 +996,30 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const - const int glow_center_x = rect.UpperLeftCorner.X + rect.getWidth()/2; - const int glow_center_y = rect.UpperLeftCorner.Y + rect.getHeight() - 5; + const int glow_center_x = rect.UpperLeftCorner.X + + rect.getWidth()/2; + const int glow_center_y = rect.UpperLeftCorner.Y + + rect.getHeight() - 5; - ITexture* tex_ficonhighlight = SkinConfig::m_render_params["focusHalo::neutral"].getImage(); + ITexture* tex_ficonhighlight = + SkinConfig::m_render_params["focusHalo::neutral"] + .getImage(); const int texture_w = tex_ficonhighlight->getSize().Width; const int texture_h = tex_ficonhighlight->getSize().Height; - core::rect source_area = core::rect(0, 0, texture_w, texture_h); + core::recti source_area(0, 0, texture_w,texture_h); - const core::rect< s32 > rect2 = core::rect< s32 >(glow_center_x - 45 - grow, - glow_center_y - 25 - grow/2, - glow_center_x + 45 + grow, - glow_center_y + 25 + grow/2); - - GUIEngine::getDriver()->draw2DImage(tex_ficonhighlight, rect2, source_area, - 0 /* no clipping */, 0, true /* alpha */); + const core::recti rect2(glow_center_x - 45 - grow, + glow_center_y - 25 - grow/2, + glow_center_x + 45 + grow, + glow_center_y + 25 + grow/2); + + GUIEngine::getDriver()->draw2DImage(tex_ficonhighlight, rect2, + source_area, + /*clipping*/ 0, + /*color*/ 0, + /*alpha*/true ); } // if we're not using glow, draw square focus instead else @@ -883,87 +1029,82 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const if (!always_show_selection && !show_focus) return; // don't mark filler items as focused - if (widget->m_properties[PROP_ID] == RibbonWidget::NO_ITEM_ID) return; - - //const int texture_w = m_tex_squarefocus->getSize().Width; - //const int texture_h = m_tex_squarefocus->getSize().Height; - //core::rect source_area = core::rect(0, 0, texture_w, texture_h); - - drawBoxFromStretchableTexture(parentRibbonWidget, rect, SkinConfig::m_render_params["squareFocusHalo::neutral"]); + if (widget->m_properties[PROP_ID] == RibbonWidget::NO_ITEM_ID) + return; + + drawBoxFromStretchableTexture(parentRibbonWidget, rect, + SkinConfig::m_render_params["squareFocusHalo::neutral"]); nPlayersOnThisItem++; } } // end if mark_focused - // ---- Draw selection for other players than player 1 - //if (parentRibbon->isFocusedForPlayer(1)) - //{ - //std::cout << - //parentRibbon->getSelectionIDString(1) << " vs " << widget->m_properties[PROP_ID].c_str() << std::endl; - //} - + // ---- Draw selection for other players than player 1 if (parentRibbon->isFocusedForPlayer(1) && - parentRibbon->getSelectionIDString(1) == widget->m_properties[PROP_ID]) + parentRibbon->getSelectionIDString(1) == + widget->m_properties[PROP_ID]) { if (nPlayersOnThisItem > 0) { - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; const int enlarge = nPlayersOnThisItem*6; rect2.UpperLeftCorner.X -= enlarge; rect2.UpperLeftCorner.Y -= enlarge; rect2.LowerRightCorner.X += enlarge; rect2.LowerRightCorner.Y += enlarge; drawBoxFromStretchableTexture(parentRibbonWidget, rect2, - SkinConfig::m_render_params["squareFocusHalo2::neutral"]); + SkinConfig::m_render_params["squareFocusHalo2::neutral"]); } else { drawBoxFromStretchableTexture(parentRibbonWidget, rect, - SkinConfig::m_render_params["squareFocusHalo2::neutral"]); + SkinConfig::m_render_params["squareFocusHalo2::neutral"]); } nPlayersOnThisItem++; } if (parentRibbon->isFocusedForPlayer(2) && - parentRibbon->getSelectionIDString(2) == widget->m_properties[PROP_ID]) + parentRibbon->getSelectionIDString(2) == + widget->m_properties[PROP_ID]) { if (nPlayersOnThisItem > 0) { - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; const int enlarge = nPlayersOnThisItem*6; rect2.UpperLeftCorner.X -= enlarge; rect2.UpperLeftCorner.Y -= enlarge; rect2.LowerRightCorner.X += enlarge; rect2.LowerRightCorner.Y += enlarge; drawBoxFromStretchableTexture(parentRibbonWidget, rect2, - SkinConfig::m_render_params["squareFocusHalo3::neutral"]); + SkinConfig::m_render_params["squareFocusHalo3::neutral"]); } else { drawBoxFromStretchableTexture(parentRibbonWidget, rect, - SkinConfig::m_render_params["squareFocusHalo3::neutral"]); + SkinConfig::m_render_params["squareFocusHalo3::neutral"]); } nPlayersOnThisItem++; } if (parentRibbon->isFocusedForPlayer(3) && - parentRibbon->getSelectionIDString(3) == widget->m_properties[PROP_ID]) + parentRibbon->getSelectionIDString(3) == + widget->m_properties[PROP_ID]) { if (nPlayersOnThisItem > 0) { - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; const int enlarge = nPlayersOnThisItem*6; rect2.UpperLeftCorner.X -= enlarge; rect2.UpperLeftCorner.Y -= enlarge; rect2.LowerRightCorner.X += enlarge; rect2.LowerRightCorner.Y += enlarge; drawBoxFromStretchableTexture(parentRibbonWidget, rect2, - SkinConfig::m_render_params["squareFocusHalo4::neutral"]); + SkinConfig::m_render_params["squareFocusHalo4::neutral"]); } else { drawBoxFromStretchableTexture(parentRibbonWidget, rect, - SkinConfig::m_render_params["squareFocusHalo4::neutral"]); + SkinConfig::m_render_params["squareFocusHalo4::neutral"]); } nPlayersOnThisItem++; } @@ -973,22 +1114,27 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const } // end if icon ribbons - if (/*mark_selected && widget->hasTooltip() && (focused || parent_focused) &&*/ parentRibbon->m_mouse_focus == widget) + if (/*mark_selected && widget->hasTooltip() && + (focused || parent_focused) &&*/ + parentRibbon->m_mouse_focus == widget) { - if (rect.isPointInside(irr_driver->getDevice()->getCursorControl()->getPosition())) + if (rect.isPointInside(irr_driver->getDevice()->getCursorControl() + ->getPosition())) { m_tooltip_at_mouse.push_back(true); m_tooltips.push_back(widget); } } -} +} // drawRibbonChild +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (whether the widget is - * focused for other players is automatically determined) + * @param focused whether this element is focus by the master player (whether + * the widget is focused for other players is automatically determined) * FIXME: ugly to pass some focuses through parameter and others not xD */ -void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused) +void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget, + const bool pressed, bool focused) { if (!focused) { @@ -997,7 +1143,8 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const const int playerID = 0; if (GUIEngine::getFocusForPlayer(playerID) != NULL) { - focused_widget = GUIEngine::getFocusForPlayer(playerID)->getIrrlichtElement(); + focused_widget = + GUIEngine::getFocusForPlayer(playerID)->getIrrlichtElement(); } if (focused_widget != NULL && widget->m_children.size()>2) { @@ -1010,78 +1157,99 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const } } - BoxRenderParams& params = (focused || pressed) ? SkinConfig::m_render_params["spinner::focused"] : - SkinConfig::m_render_params["spinner::neutral"]; + BoxRenderParams& params = (focused || pressed) + ? SkinConfig::m_render_params["spinner::focused"] + : SkinConfig::m_render_params["spinner::neutral"]; if (widget->isFocusedForPlayer(1)) { - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; rect2.UpperLeftCorner.X += 2; rect2.UpperLeftCorner.Y -= 3; rect2.LowerRightCorner.X -= 2; rect2.LowerRightCorner.Y += 5; - drawBoxFromStretchableTexture(widget, rect2, SkinConfig::m_render_params["squareFocusHalo2::neutral"]); + drawBoxFromStretchableTexture(widget, rect2, + SkinConfig::m_render_params["squareFocusHalo2::neutral"]); } else if (widget->isFocusedForPlayer(2)) { - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; rect2.UpperLeftCorner.X += 2; rect2.UpperLeftCorner.Y -= 3; rect2.LowerRightCorner.X -= 2; rect2.LowerRightCorner.Y += 5; - drawBoxFromStretchableTexture(widget, rect2, SkinConfig::m_render_params["squareFocusHalo3::neutral"]); + drawBoxFromStretchableTexture(widget, rect2, + SkinConfig::m_render_params["squareFocusHalo3::neutral"]); } else if (widget->isFocusedForPlayer(3)) { - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; rect2.UpperLeftCorner.X += 2; rect2.UpperLeftCorner.Y -= 3; rect2.LowerRightCorner.X -= 2; rect2.LowerRightCorner.Y += 5; - drawBoxFromStretchableTexture(widget, rect2, SkinConfig::m_render_params["squareFocusHalo4::neutral"]); + drawBoxFromStretchableTexture(widget, rect2, + SkinConfig::m_render_params["squareFocusHalo4::neutral"]); } - core::rect< s32 > sized_rect = rect; + core::recti sized_rect = rect; if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && widget->m_parent->getType() == gui::EGUIET_WINDOW) { - core::position2d center = core::position2d(irr_driver->getFrameSize()/2); + core::position2d center(irr_driver->getFrameSize()/2); const float texture_size = sin(m_dialog_size*M_PI*0.5f); - sized_rect.UpperLeftCorner.X = center.X + (int)(((int)rect.UpperLeftCorner.X - (int)center.X)*texture_size); - sized_rect.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size); + sized_rect.UpperLeftCorner.X = + center.X + (int)(((int)rect.UpperLeftCorner.X + - (int)center.X)*texture_size); + sized_rect.UpperLeftCorner.Y = + center.Y + (int)(((int)rect.UpperLeftCorner.Y + - (int)center.Y)*texture_size); - //std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y << " - " << center.Y << ")*" << texture_size << " = " - // << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y)*texture_size) << std::endl; + //std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y + // << " - " << center.Y << ")*" << texture_size << " = " + // << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y)* + // texture_size) << std::endl; - sized_rect.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size); - sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size); + sized_rect.LowerRightCorner.X = + center.X + (int)(((int)rect.LowerRightCorner.X + - (int)center.X)*texture_size); + sized_rect.LowerRightCorner.Y = + center.Y + (int)(((int)rect.LowerRightCorner.Y + - (int)center.Y)*texture_size); } - drawBoxFromStretchableTexture(widget, sized_rect, params, widget->m_deactivated); + drawBoxFromStretchableTexture(widget, sized_rect, params, + widget->m_deactivated); // ---- If this spinner is of "gauge" type, draw filling const SpinnerWidget* w = dynamic_cast(widget); if (w->isGauge() && !w->m_deactivated) { - const int handle_size = (int)( widget->m_h*params.m_left_border/(float)params.getImage()->getSize().Height ); - const float value = (float)(w->getValue() - w->getMin()) / (w->getMax() - w->getMin()); + const int handle_size = (int)( widget->m_h*params.m_left_border + /(float)params.getImage()->getSize().Height ); + const float value = (float)(w->getValue() - w->getMin()) + / (w->getMax() - w->getMin()); - const core::rect< s32 > dest_area = core::rect< s32 >(widget->m_x + handle_size, - widget->m_y, - widget->m_x + handle_size + (int)((widget->m_w - 2*handle_size)*value), - widget->m_y + widget->m_h); + const core::recti dest_area(widget->m_x + handle_size, + widget->m_y, + widget->m_x + handle_size + + (int)((widget->m_w + - 2*handle_size)*value), + widget->m_y + widget->m_h); - const ITexture* texture = SkinConfig::m_render_params["gaugefill::neutral"].getImage(); + const ITexture* texture = + SkinConfig::m_render_params["gaugefill::neutral"].getImage(); const int texture_w = texture->getSize().Width; const int texture_h = texture->getSize().Height; - const core::rect< s32 > source_area = core::rect< s32 >(0, 0, texture_w, texture_h); + const core::recti source_area(0, 0, texture_w, texture_h); GUIEngine::getDriver()->draw2DImage(texture, dest_area, source_area, - 0 /* no clipping */, 0, true /* alpha */); + 0 /* no clipping */, 0, + true /* alpha */); } @@ -1092,38 +1260,48 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const } } +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (focus for other players is not supported) + * @param focused whether this element is focus by the master player (focus for + * other players is not supported) */ -void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused) +void Skin::drawSpinnerChild(const core::recti &rect, Widget* widget, + const bool pressed, bool focused) { if (pressed) { Widget* spinner = widget->m_event_handler; int areas = 0; - //std::cout << "drawing spinner child " << widget->m_properties[PROP_ID].c_str() << std::endl; + //std::cout << "drawing spinner child " + // << widget->m_properties[PROP_ID].c_str() << std::endl; - if (widget->m_properties[PROP_ID] == "left") areas = BoxRenderParams::LEFT; - else if (widget->m_properties[PROP_ID] == "right") areas = BoxRenderParams::RIGHT; - else return; + if (widget->m_properties[PROP_ID] == "left") + areas = BoxRenderParams::LEFT; + else if (widget->m_properties[PROP_ID] == "right") + areas = BoxRenderParams::RIGHT; + else + return; - core::rect< s32 > rect2 = core::rect< s32 >( spinner->m_x, - spinner->m_y, - spinner->m_x + spinner->m_w, - spinner->m_y + spinner->m_h ); + core::recti rect2(spinner->m_x, spinner->m_y, + spinner->m_x + spinner->m_w, + spinner->m_y + spinner->m_h ); BoxRenderParams& params = SkinConfig::m_render_params["spinner::down"]; params.areas = areas; - drawBoxFromStretchableTexture(widget, rect, params, widget->m_deactivated); + drawBoxFromStretchableTexture(widget, rect, params, + widget->m_deactivated); } } +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (focus for other players is not supported) + * @param focused whether this element is focus by the master player (focus for +* other players is not supported) */ -void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused) +void Skin::drawIconButton(const core::recti &rect, Widget* widget, + const bool pressed, bool focused) { if (focused) { @@ -1137,45 +1315,62 @@ void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const b grow = (int)(45 + 10*sin(glow_effect)); - const int glow_center_x = rect.UpperLeftCorner.X + rect.getWidth()/2; + const int glow_center_x = rect.UpperLeftCorner.X+rect.getWidth()/2; const int glow_center_y = rect.LowerRightCorner.Y; - ITexture* tex_ficonhighlight = SkinConfig::m_render_params["focusHalo::neutral"].getImage(); + ITexture* tex_ficonhighlight = + SkinConfig::m_render_params["focusHalo::neutral"].getImage(); const int texture_w = tex_ficonhighlight->getSize().Width; const int texture_h = tex_ficonhighlight->getSize().Height; - core::rect source_area = core::rect(0, 0, texture_w, texture_h); + core::recti source_area = core::recti(0, 0, texture_w, texture_h); - const core::rect< s32 > rect2 = core::rect< s32 >(glow_center_x - 45 - grow, - glow_center_y - 25 - grow/2, - glow_center_x + 45 + grow, - glow_center_y + 25 + grow/2); + const core::recti rect2(glow_center_x - 45 - grow, + glow_center_y - 25 - grow/2, + glow_center_x + 45 + grow, + glow_center_y + 25 + grow/2); - GUIEngine::getDriver()->draw2DImage(tex_ficonhighlight, rect2, source_area, - 0 /* no clipping */, 0, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(tex_ficonhighlight, rect2, + source_area, + 0 /* no clipping */, 0, + true /* alpha */); } - core::rect< s32 > sized_rect = rect; + core::recti sized_rect = rect; if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && widget->m_parent->getType() == gui::EGUIET_WINDOW) { - core::position2d center = core::position2d(irr_driver->getFrameSize()/2); + core::position2d center(irr_driver->getFrameSize()/2); const float texture_size = sin(m_dialog_size*M_PI*0.5f); - sized_rect.UpperLeftCorner.X = center.X + (int)(((int)rect.UpperLeftCorner.X - (int)center.X)*texture_size); - sized_rect.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size); + sized_rect.UpperLeftCorner.X = + center.X + (int)(((int)rect.UpperLeftCorner.X + - (int)center.X)*texture_size); + sized_rect.UpperLeftCorner.Y = + center.Y + (int)(((int)rect.UpperLeftCorner.Y + - (int)center.Y)*texture_size); - //std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y << " - " << center.Y << ")*" << texture_size << " = " - // << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y)*texture_size) << std::endl; + //std::cout << "y is " << center.Y << " + (" << rect.UpperLeftCorner.Y + // << " - " << center.Y << ")*" << texture_size << " = " + // << center.Y + (int)((rect.UpperLeftCorner.Y - center.Y) + // *texture_size) << std::endl; - sized_rect.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size); - sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size); + sized_rect.LowerRightCorner.X = + center.X + (int)(((int)rect.LowerRightCorner.X + - (int)center.X)*texture_size); + sized_rect.LowerRightCorner.Y = + center.Y + (int)(((int)rect.LowerRightCorner.Y + - (int)center.Y)*texture_size); /* - std::cout << texture_size << " : " << rect.UpperLeftCorner.X << ", " << rect.UpperLeftCorner.Y << " : " << - rect.LowerRightCorner.X << ", " << rect.LowerRightCorner.Y << " ---> " << - sized_rect.UpperLeftCorner.X << ", " << sized_rect.UpperLeftCorner.Y << " : " << - sized_rect.LowerRightCorner.X << ", " << sized_rect.LowerRightCorner.Y << std::endl; + std::cout << texture_size << " : " << rect.UpperLeftCorner.X + << ", " << rect.UpperLeftCorner.Y << " : " << + rect.LowerRightCorner.X << ", " << rect.LowerRightCorner.Y + << " ---> " << + sized_rect.UpperLeftCorner.X << ", " + << sized_rect.UpperLeftCorner.Y << " : " << + sized_rect.LowerRightCorner.X << ", " + << sized_rect.LowerRightCorner.Y << std::endl; */ } @@ -1194,36 +1389,41 @@ void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const b SColor(100,255,255,255), SColor(100,255,255,255), SColor(100,255,255,255) }; + core::recti r(0,0,icon_widget->m_texture_w, icon_widget->m_texture_h); GUIEngine::getDriver()->draw2DImage(icon_widget->m_texture, sized_rect, - core::rect(0,0,icon_widget->m_texture_w, icon_widget->m_texture_h), - 0 /* no clipping */, colors, true /* alpha */); + r, 0 /* no clipping */, colors, + true /* alpha */); } else { video::ITexture* t = icon_widget->m_texture; - const bool mouseInside = rect.isPointInside(irr_driver->getDevice()->getCursorControl()->getPosition()); - if (icon_widget->m_highlight_texture != NULL && (focused || mouseInside)) + const bool mouseInside = + rect.isPointInside(irr_driver->getDevice()->getCursorControl() + ->getPosition()); + if (icon_widget->m_highlight_texture != NULL && + (focused || mouseInside) ) { t = icon_widget->m_highlight_texture; } - - GUIEngine::getDriver()->draw2DImage(t, sized_rect, - core::rect(0,0,icon_widget->m_texture_w, icon_widget->m_texture_h), - 0 /* no clipping */, 0, true /* alpha */); + core::recti r(0,0,icon_widget->m_texture_w, icon_widget->m_texture_h); + GUIEngine::getDriver()->draw2DImage(t, sized_rect, r,0 + /* no clipping */, 0, + true /* alpha */); } if (widget->m_type == WTYPE_MODEL_VIEW) { irr_driver->getVideoDriver()->enableMaterial2D(); } -} +} // drawIconButton - +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (focus for other players is not supported) + * @param focused whether this element is focus by the master player (focus +* for other players is not supported) */ -void Skin::drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focused) +void Skin::drawCheckBox(const core::recti &rect, Widget* widget, bool focused) { CheckBoxWidget* w = dynamic_cast(widget); @@ -1231,19 +1431,25 @@ void Skin::drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focu if (w->getState() == true) { - if (focused) texture = SkinConfig::m_render_params["checkbox::focused+checked"].getImage(); - else texture = SkinConfig::m_render_params["checkbox::neutral+checked"].getImage(); + texture = focused + ? SkinConfig::m_render_params["checkbox::focused+checked"] + .getImage() + : SkinConfig::m_render_params["checkbox::neutral+checked"] + .getImage(); } else { - if (focused) texture = SkinConfig::m_render_params["checkbox::focused+unchecked"].getImage(); - else texture = SkinConfig::m_render_params["checkbox::neutral+unchecked"].getImage(); + texture = focused + ? SkinConfig::m_render_params["checkbox::focused+unchecked"] + .getImage() + : SkinConfig::m_render_params["checkbox::neutral+unchecked"] + .getImage(); } const int texture_w = texture->getSize().Width; const int texture_h = texture->getSize().Height; - const core::rect< s32 > source_area = core::rect< s32 >(0, 0, texture_w, texture_h); + const core::recti source_area = core::recti(0, 0, texture_w, texture_h); if (widget->m_deactivated) { @@ -1252,67 +1458,76 @@ void Skin::drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focu SColor(100,255,255,255), SColor(100,255,255,255) }; GUIEngine::getDriver()->draw2DImage( texture, rect, source_area, - 0 /* no clipping */, colors, true /* alpha */); + 0 /* no clipping */, colors, + true /* alpha */); } else { GUIEngine::getDriver()->draw2DImage( texture, rect, source_area, - 0 /* no clipping */, 0, true /* alpha */); + 0 /* no clipping */, 0, + true /* alpha */); } -} +} // drawCheckBox +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (focus for other players is not supported) + * @param focused whether this element is focus by the master player (focus + * for other players is not supported) */ -void Skin::drawList(const core::rect< s32 > &rect, Widget* widget, bool focused) +void Skin::drawList(const core::recti &rect, Widget* widget, bool focused) { - drawBoxFromStretchableTexture(widget, rect, SkinConfig::m_render_params["list::neutral"]); + drawBoxFromStretchableTexture(widget, rect, + SkinConfig::m_render_params["list::neutral"]); -} +} // drawList +// ---------------------------------------------------------------------------- /** - * @param focused whether this element is focus by the master player (focus for other players is not supported) + * @param focused whether this element is focus by the master player (focus for +* other players is not supported) */ -void Skin::drawListSelection(const core::rect< s32 > &rect, Widget* widget, bool focused, - const core::rect< s32 > *clip) +void Skin::drawListSelection(const core::recti &rect, Widget* widget, + bool focused, const core::recti *clip) { ListWidget* list = dynamic_cast(widget); assert(list != NULL); drawBoxFromStretchableTexture(&list->m_selection_skin_info, rect, - SkinConfig::m_render_params["listitem::focused"], false, clip); -} + SkinConfig::m_render_params["listitem::focused"], + false, clip); +} // drawListSelection -void Skin::drawListHeader(const irr::core::rect< irr::s32 > &rect, Widget* widget) +// ---------------------------------------------------------------------------- +void Skin::drawListHeader(const irr::core::rect< irr::s32 > &rect, + Widget* widget) { - //ListWidget* list = dynamic_cast(widget); - //assert(list != NULL); - - //IGUIButton* btn = widget->getIrrlichtElement(); - - bool isSelected = (((ListWidget*)widget->m_event_handler)->m_selected_column == widget); + bool isSelected =(((ListWidget*)widget->m_event_handler)->m_selected_column + == widget); drawBoxFromStretchableTexture(widget, rect, - (isSelected ? SkinConfig::m_render_params["list_header::down"] : - SkinConfig::m_render_params["list_header::neutral"]), - false, NULL /* clip */); + (isSelected ? SkinConfig::m_render_params["list_header::down"] + : SkinConfig::m_render_params["list_header::neutral"]), + false, NULL /* clip */); if (isSelected) { - ITexture* img = SkinConfig::m_render_params["list_sort_up::neutral"].getImage(); - core::rect< s32 > destRect(rect.UpperLeftCorner, - core::dimension2d(rect.getHeight(), rect.getHeight())); - core::rect< s32 > srcRect(core::position2d(0,0), img->getSize()); - irr_driver->getVideoDriver()->draw2DImage(img, destRect, srcRect, NULL, NULL, true /* alpha */); + ITexture* img = + SkinConfig::m_render_params["list_sort_up::neutral"].getImage(); + core::recti destRect(rect.UpperLeftCorner, + core::dimension2di(rect.getHeight(), + rect.getHeight())); + core::recti srcRect(core::position2d(0,0), img->getSize()); + irr_driver->getVideoDriver()->draw2DImage(img, destRect, srcRect, + NULL, NULL, /* alpha */true); } - //GUIEngine::getFont()->draw( list->getHeader(), rect, irr::video::SColor(255,0,0,0) ); //getColor("text") ); -} +} // drawListHeader -/** recursive function to render all sections (recursion allows to easily traverse the tree of children - * and sub-children) - */ +// ---------------------------------------------------------------------------- +/** recursive function to render all sections (recursion allows to easily + * traverse the tree of children and sub-children) + */ void Skin::renderSections(PtrVector* within_vector) { if (within_vector == NULL) within_vector = &getCurrentScreen()->m_widgets; @@ -1329,37 +1544,38 @@ void Skin::renderSections(PtrVector* within_vector) { if (widget.m_is_bounding_box_round) { - core::rect< s32 > rect = core::rect(widget.m_x, - widget.m_y, - widget.m_x + widget.m_w, - widget.m_y + widget.m_h ); + core::recti rect(widget.m_x, widget.m_y, + widget.m_x + widget.m_w, + widget.m_y + widget.m_h ); drawBoxFromStretchableTexture(&widget, rect, - SkinConfig::m_render_params["rounded_section::neutral"]); + SkinConfig::m_render_params["rounded_section::neutral"]); } else { - core::rect< s32 > rect = core::rect(widget.m_x, - widget.m_y, - widget.m_x + widget.m_w, - widget.m_y + widget.m_h ); + core::recti rect(widget.m_x, widget.m_y, + widget.m_x + widget.m_w, + widget.m_y + widget.m_h ); drawBoxFromStretchableTexture(&widget, rect, - SkinConfig::m_render_params["section::neutral"]); + SkinConfig::m_render_params["section::neutral"]); } } else if (widget.isBottomBar()) { - const core::dimension2d framesize = irr_driver->getFrameSize(); + const core::dimension2du &framesize = + irr_driver->getFrameSize(); // bar.png is 128 pixels high const float y_size = (framesize.Height - widget.m_y) / 128.0f; // there's about 40 empty pixels at the top of bar.png - ITexture* tex = irr_driver->getTexture( file_manager->getGUIDir() + "bar.png" ); - irr_driver->getVideoDriver()->draw2DImage(tex, core::rect(0, (int)(widget.m_y - 40*y_size), - framesize.Width, framesize.Height), - core::rect(core::dimension2di(0,0), tex->getSize()), - 0, 0, true /* alpha */ - ); + ITexture* tex = + irr_driver->getTexture( file_manager->getGUIDir() + + "bar.png" ); + core::recti r1(0, (int)(widget.m_y - 40*y_size), + framesize.Width, framesize.Height); + core::recti r2(core::dimension2di(0,0), tex->getSize()); + irr_driver->getVideoDriver()->draw2DImage(tex, r1, r2, + 0, 0, /*alpha*/true); } else { @@ -1368,44 +1584,54 @@ void Skin::renderSections(PtrVector* within_vector) } } // next -} +} // renderSections +// ---------------------------------------------------------------------------- void Skin::drawScrollbarBackground(const irr::core::rect< irr::s32 > &rect) { - // leave square space at both ends for up/down buttons (yeah, irrlicht doesn't handle that) - core::rect rect2 = rect; + // leave square space at both ends for up/down buttons (yeah, irrlicht + // doesn't handle that) + core::recti rect2 = rect; rect2.UpperLeftCorner.Y += rect.getWidth(); rect2.LowerRightCorner.Y -= rect.getWidth(); - BoxRenderParams& p = SkinConfig::m_render_params["scrollbar_background::neutral"]; + BoxRenderParams& p = + SkinConfig::m_render_params["scrollbar_background::neutral"]; - GUIEngine::getDriver()->draw2DImage(p.getImage(), rect2, p.m_source_area_center, - 0 /* no clipping */, 0, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(p.getImage(), rect2, + p.m_source_area_center, + 0 /* no clipping */, 0, + true /* alpha */); - //drawBoxFromStretchableTexture(NULL, rect, SkinConfig::m_render_params["scrollbar_background::neutral"]); -} +} // drawScrollbarBackground +// ---------------------------------------------------------------------------- void Skin::drawScrollbarThumb(const irr::core::rect< irr::s32 > &rect) { - BoxRenderParams& p = SkinConfig::m_render_params["scrollbar_thumb::neutral"]; + BoxRenderParams& p = + SkinConfig::m_render_params["scrollbar_thumb::neutral"]; - GUIEngine::getDriver()->draw2DImage(p.getImage(), rect, p.m_source_area_center, - 0 /* no clipping */, 0, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(p.getImage(), rect, + p.m_source_area_center, + 0 /* no clipping */, 0, + true /* alpha */); - //drawBoxFromStretchableTexture(NULL, rect, SkinConfig::m_render_params["scrollbar_thumb::neutral"]); -} +} // drawScrollbarThumb -void Skin::drawScrollbarButton(const irr::core::rect< irr::s32 > &rect, const bool pressed, - const bool bottomArrow) +// ---------------------------------------------------------------------------- +void Skin::drawScrollbarButton(const irr::core::rect< irr::s32 > &rect, + const bool pressed, const bool bottomArrow) { BoxRenderParams& p = (pressed) - ? SkinConfig::m_render_params["scrollbar_button::down"] - : SkinConfig::m_render_params["scrollbar_button::neutral"]; + ? SkinConfig::m_render_params["scrollbar_button::down"] + : SkinConfig::m_render_params["scrollbar_button::neutral"]; if (!bottomArrow) { - GUIEngine::getDriver()->draw2DImage(p.getImage(), rect, p.m_source_area_center, - 0 /* no clipping */, 0, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(p.getImage(), rect, + p.m_source_area_center, + 0 /* no clipping */, 0, + true /* alpha */); } else { @@ -1416,12 +1642,15 @@ void Skin::drawScrollbarButton(const irr::core::rect< irr::s32 > &rect, const bo const int y0 = source_area.UpperLeftCorner.Y; const int y1 = source_area.LowerRightCorner.Y; - GUIEngine::getDriver()->draw2DImage(p.getImage(), rect, core::rect(x0, y1, x1, y0), - 0 /* no clipping */, 0, true /* alpha */); + GUIEngine::getDriver()->draw2DImage(p.getImage(), rect, + core::recti(x0, y1, x1, y0), + 0 /* no clipping */, 0, + true /* alpha */); } -} +} // drawScrollbarButton +// ---------------------------------------------------------------------------- void Skin::drawTooltips() { for (unsigned int n=0; ngetTooltipText().size() == 0) return; irr::gui::ScalableFont* font = GUIEngine::getSmallFont(); - core::dimension2d size = font->getDimension(widget->getTooltipText().c_str()); + core::dimension2d size = + font->getDimension(widget->getTooltipText().c_str()); core::position2di pos(widget->m_x + 15, widget->m_y + widget->m_h); if (atMouse) { - pos = irr_driver->getDevice()->getCursorControl()->getPosition() + core::position2di(15, 15); + pos = irr_driver->getDevice()->getCursorControl()->getPosition() + + core::position2di(15, 15); } - core::rect r(pos, size); - //GUIEngine::getDriver()->draw2DRectangle( video::SColor(255, 200, 200, 200), r ); + core::recti r(pos, size); drawBoxFromStretchableTexture(widget, r, - SkinConfig::m_render_params["tooltip::neutral"]); - font->draw(widget->getTooltipText(), r, video::SColor(255, 0, 0, 0), false, false); -} + SkinConfig::m_render_params["tooltip::neutral"]); + font->draw(widget->getTooltipText(), r, video::SColor(255, 0, 0, 0), + false, false); +} // drawTooltip #if 0 #pragma mark - #pragma mark irrlicht skin functions #endif -void Skin::draw2DRectangle (IGUIElement *element, const video::SColor &color, const core::rect< s32 > &rect, - const core::rect< s32 > *clip) +// ---------------------------------------------------------------------------- +void Skin::draw2DRectangle (IGUIElement *element, const video::SColor &color, + const core::recti &rect, const core::recti *clip) { - if (GUIEngine::getStateManager()->getGameState() == GUIEngine::GAME) return; // ignore in game mode + if (GUIEngine::getStateManager()->getGameState() == GUIEngine::GAME) + return; // ignore in game mode if (element->getType() == gui::EGUIET_SCROLL_BAR) { @@ -1477,15 +1711,16 @@ void Skin::draw2DRectangle (IGUIElement *element, const video::SColor &color, co if (type == WTYPE_LIST) { // lists not supported in multiplayer screens - const bool focused = GUIEngine::isFocusedForPlayer(widget, PLAYER_ID_GAME_MASTER); + const bool focused = + GUIEngine::isFocusedForPlayer(widget, PLAYER_ID_GAME_MASTER); drawListSelection(rect, widget, focused, clip); } -} +} // draw2DRectangle // ----------------------------------------------------------------------------- - -void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, const bool pressed) +void Skin::process3DPane(IGUIElement *element, const core::recti &rect, + const bool pressed) { const int id = element->getID(); @@ -1494,10 +1729,12 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co if (widget == NULL) { - if (element->getType() == gui::EGUIET_BUTTON && element->getParent() != NULL && + if (element->getType() == gui::EGUIET_BUTTON && + element->getParent() != NULL && element->getParent()->getType() == EGUIET_SCROLL_BAR) { - const int parentHeight = element->getParent()->getRelativePosition().getHeight(); + const int parentHeight = + element->getParent()->getRelativePosition().getHeight(); const int y = element->getRelativePosition().UpperLeftCorner.Y; const bool bottomButton = (y > parentHeight/2); @@ -1508,12 +1745,15 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co return; } - const bool focused = GUIEngine::isFocusedForPlayer(widget, PLAYER_ID_GAME_MASTER); + const bool focused = + GUIEngine::isFocusedForPlayer(widget, PLAYER_ID_GAME_MASTER); /* - std::cout << "Skin (3D Pane) : " << (widget == NULL ? "NULL!!" : widget->m_properties[PROP_ID].c_str()) + std::cout << "Skin (3D Pane) : " << (widget == NULL ? "NULL!!" : + widget->m_properties[PROP_ID].c_str()) << std::endl; - if (widget == NULL) std::cout << "Null widget: ID=" << id << " type=" << element->getTypeName() << + if (widget == NULL) std::cout << "Null widget: ID=" << id << " type=" + << element->getTypeName() << " x=" << rect.UpperLeftCorner.X << " y=" << rect.UpperLeftCorner.Y << " w=" << rect.getWidth() << " h=" << rect.getHeight() << std::endl; @@ -1523,17 +1763,21 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co const WidgetType type = widget->m_type; - // buttons are used for other uses than plain clickable buttons because irrLicht - // does not have widgets for everything we need. so at render time, we just check - // which type this button represents and render accordingly + // buttons are used for other uses than plain clickable buttons because + // irrLicht does not have widgets for everything we need. so at render + // time, we just check which type this button represents and render + // accordingly - if (widget->m_event_handler != NULL && widget->m_event_handler->m_type == WTYPE_RIBBON) + if (widget->m_event_handler != NULL && + widget->m_event_handler->m_type == WTYPE_RIBBON) { drawRibbonChild(rect, widget, pressed, focused); } - else if (widget->m_event_handler != NULL && widget->m_event_handler->m_type == WTYPE_SPINNER) + else if (widget->m_event_handler != NULL && + widget->m_event_handler->m_type == WTYPE_SPINNER) { - if (!widget->m_event_handler->m_deactivated) drawSpinnerChild(rect, widget, pressed, focused); + if (!widget->m_event_handler->m_deactivated) + drawSpinnerChild(rect, widget, pressed, focused); } else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW) { @@ -1541,7 +1785,8 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co } else if (type == WTYPE_BUTTON) { - if (widget->m_event_handler != NULL && widget->m_event_handler->getType() == WTYPE_LIST) + if (widget->m_event_handler != NULL && + widget->m_event_handler->getType() == WTYPE_LIST) { drawListHeader(rect, widget); } @@ -1578,93 +1823,104 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co if (widget->m_badges != 0) { - drawBadgeOn(widget, rect + position2d(widget->m_badge_x_shift, 0)); + drawBadgeOn(widget, rect+position2d(widget->m_badge_x_shift, 0)); } -} +} // process3DPane // ----------------------------------------------------------------------------- - -void doDrawBadge(ITexture* texture, const core::rect& rect, float max_icon_size, bool badge_at_left) +void doDrawBadge(ITexture* texture, const core::recti& rect, + float max_icon_size, bool badge_at_left) { const core::dimension2d& texture_size = texture->getSize(); - const float aspectRatio = (float)texture_size.Width / (float)texture_size.Height; - const int h = rect.getHeight() <= 50 ? - rect.getHeight() : - std::min( (int)(rect.getHeight()*max_icon_size), (int)(texture_size.Height) ); + const float aspectRatio = (float)texture_size.Width + / (float)texture_size.Height; + const int h = rect.getHeight() <= 50 + ? rect.getHeight() + : std::min( (int)(rect.getHeight()*max_icon_size), + (int)(texture_size.Height) ); int w = (int)(aspectRatio*h); - const core::rect source_area = core::rect(0, 0, texture_size.Width, texture_size.Height); + const core::recti source_area(0, 0, texture_size.Width, + texture_size.Height); - const core::rect< s32 > rect2 = core::rect< s32 >(badge_at_left ? - rect.UpperLeftCorner.X : - rect.LowerRightCorner.X - w, - rect.LowerRightCorner.Y - h, - badge_at_left ? - rect.UpperLeftCorner.X + w : - rect.LowerRightCorner.X, - rect.LowerRightCorner.Y); + const core::recti rect2(badge_at_left ? rect.UpperLeftCorner.X + : rect.LowerRightCorner.X - w, + rect.LowerRightCorner.Y - h, + badge_at_left ? rect.UpperLeftCorner.X + w + : rect.LowerRightCorner.X, + rect.LowerRightCorner.Y ); GUIEngine::getDriver()->draw2DImage(texture, rect2, source_area, - 0 /* no clipping */, 0, true /* alpha */); -} + 0 /* no clipping */, 0, + true /* alpha */); +} // doDrawBadge -void Skin::drawBadgeOn(const Widget* widget, const core::rect& rect) +// ---------------------------------------------------------------------------- +void Skin::drawBadgeOn(const Widget* widget, const core::recti& rect) { if (widget->m_badges & LOCKED_BADGE) { - video::ITexture* texture = irr_driver->getTexture(file_manager->getTextureFile("gui_lock.png")); + video::ITexture* texture = irr_driver->getTexture( + file_manager->getTextureFile("gui_lock.png")); float max_icon_size = 0.5f; // Lock badge can be quite big doDrawBadge(texture, rect, max_icon_size, true); } if (widget->m_badges & OK_BADGE) { - video::ITexture* texture = irr_driver->getTexture(file_manager->getTextureFile("green_check.png")); + video::ITexture* texture = irr_driver->getTexture( + file_manager->getTextureFile("green_check.png")); float max_icon_size = 0.35f; doDrawBadge(texture, rect, max_icon_size, true); } if (widget->m_badges & BAD_BADGE) { - video::ITexture* texture = irr_driver->getTexture(file_manager->getTextureFile("red_mark.png")); + video::ITexture* texture = irr_driver->getTexture( + file_manager->getTextureFile("red_mark.png")); float max_icon_size = 0.35f; doDrawBadge(texture, rect, max_icon_size, false); } if (widget->m_badges & TROPHY_BADGE) { float max_icon_size = 0.43f; - video::ITexture* texture = irr_driver->getTexture(file_manager->getTextureFile("cup_bronze.png")); + video::ITexture* texture = irr_driver->getTexture( + file_manager->getTextureFile("cup_bronze.png")); doDrawBadge(texture, rect, max_icon_size, false); } if (widget->m_badges & KEYBOARD_BADGE) { float max_icon_size = 0.43f; - video::ITexture* texture = irr_driver->getTexture(file_manager->getGUIDir() + "keyboard.png"); + video::ITexture* texture = irr_driver->getTexture( + file_manager->getGUIDir() + "keyboard.png"); doDrawBadge(texture, rect, max_icon_size, true); } if (widget->m_badges & GAMEPAD_BADGE) { float max_icon_size = 0.43f; - video::ITexture* texture = irr_driver->getTexture(file_manager->getGUIDir() + "gamepad.png"); + video::ITexture* texture = irr_driver->getTexture( + file_manager->getGUIDir() + "gamepad.png"); doDrawBadge(texture, rect, max_icon_size, true); } if (widget->m_badges & LOADING_BADGE) { float max_icon_size = 0.43f; - video::ITexture* texture = irr_driver->getTexture(file_manager->getGUIDir() + "hourglass.png"); + video::ITexture* texture = irr_driver->getTexture( + file_manager->getGUIDir() + "hourglass.png"); doDrawBadge(texture, rect, max_icon_size, true); } -} -// ----------------------------------------------------------------------------- +} // drawBadgeOn -void Skin::draw3DButtonPanePressed (IGUIElement *element, const core::rect< s32 > &rect, - const core::rect< s32 > *clip) +// ----------------------------------------------------------------------------- +void Skin::draw3DButtonPanePressed (IGUIElement *element, + const core::recti &rect, + const core::recti *clip) { process3DPane(element, rect, true /* pressed */ ); -} +} // draw3DButtonPanePressed // ----------------------------------------------------------------------------- - -void Skin::draw3DButtonPaneStandard (IGUIElement *element, const core::rect< s32 > &rect, - const core::rect< s32 > *clip) +void Skin::draw3DButtonPaneStandard (IGUIElement *element, + const core::recti &rect, + const core::recti *clip) { if (element->getType()==gui::EGUIET_SCROLL_BAR) { @@ -1674,12 +1930,12 @@ void Skin::draw3DButtonPaneStandard (IGUIElement *element, const core::rect< s32 { process3DPane(element, rect, false /* pressed */ ); } -} +} // draw3DButtonPaneStandard // ----------------------------------------------------------------------------- - -void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool flat, bool fillBackGround, - const core::rect< s32 > &rect, const core::rect< s32 > *clip) +void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, + bool flat, bool fillBackGround, + const core::recti &rect, const core::recti *clip) { const int id = element->getID(); Widget* widget = GUIEngine::getWidget(id); @@ -1691,7 +1947,8 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f IGUIElement* focusedElem = NULL; if (GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) != NULL) { - focusedElem = GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER)->getIrrlichtElement(); + focusedElem = GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) + ->getIrrlichtElement(); } const bool focused = (focusedElem == element); @@ -1703,7 +1960,7 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f if (focused) { - core::rect< s32 > borderArea = rect; + core::recti borderArea = rect; borderArea.UpperLeftCorner -= position2d< s32 >( 2, 2 ); borderArea.LowerRightCorner += position2d< s32 >( 2, 2 ); @@ -1711,17 +1968,25 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && widget->m_parent->getType() == gui::EGUIET_WINDOW) { - core::position2d center = core::position2d(irr_driver->getFrameSize()/2); + core::position2d center(irr_driver->getFrameSize()/2); const float texture_size = sin(m_dialog_size*M_PI*0.5f); - borderArea.UpperLeftCorner.X = center.X + (int)(((int)rect.UpperLeftCorner.X - (int)center.X)*texture_size); - borderArea.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size); - borderArea.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size); - borderArea.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size); + borderArea.UpperLeftCorner.X = + center.X + (int)(((int)rect.UpperLeftCorner.X + - (int)center.X)*texture_size); + borderArea.UpperLeftCorner.Y = + center.Y + (int)(((int)rect.UpperLeftCorner.Y + - (int)center.Y)*texture_size); + borderArea.LowerRightCorner.X = + center.X + (int)(((int)rect.LowerRightCorner.X + - (int)center.X)*texture_size); + borderArea.LowerRightCorner.Y = + center.Y + (int)(((int)rect.LowerRightCorner.Y + - (int)center.Y)*texture_size); } GUIEngine::getDriver()->draw2DRectangle( colorFocus, borderArea ); - core::rect< s32 > innerArea = borderArea; + core::recti innerArea = borderArea; innerArea.UpperLeftCorner += position2d< s32 >( 2, 2 ); innerArea.LowerRightCorner -= position2d< s32 >( 2, 2 ); GUIEngine::getDriver()->draw2DRectangle( color, innerArea ); @@ -1732,13 +1997,21 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && widget->m_parent->getType() == gui::EGUIET_WINDOW) { - core::position2d center = core::position2d(irr_driver->getFrameSize()/2); + core::position2d center(irr_driver->getFrameSize()/2); const float texture_size = sin(m_dialog_size*M_PI*0.5f); - core::rect< s32 > sizedRect; - sizedRect.UpperLeftCorner.X = center.X + (int)(((int)rect.UpperLeftCorner.X - (int)center.X)*texture_size); - sizedRect.UpperLeftCorner.Y = center.Y + (int)(((int)rect.UpperLeftCorner.Y - (int)center.Y)*texture_size); - sizedRect.LowerRightCorner.X = center.X + (int)(((int)rect.LowerRightCorner.X - (int)center.X)*texture_size); - sizedRect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size); + core::recti sizedRect; + sizedRect.UpperLeftCorner.X = + center.X + (int)(((int)rect.UpperLeftCorner.X + - (int)center.X)*texture_size); + sizedRect.UpperLeftCorner.Y = + center.Y + (int)(((int)rect.UpperLeftCorner.Y + - (int)center.Y)*texture_size); + sizedRect.LowerRightCorner.X = + center.X + (int)(((int)rect.LowerRightCorner.X + - (int)center.X)*texture_size); + sizedRect.LowerRightCorner.Y = + center.Y + (int)(((int)rect.LowerRightCorner.Y + - (int)center.Y)*texture_size); GUIEngine::getDriver()->draw2DRectangle( color, sizedRect ); } else @@ -1752,17 +2025,10 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f { //drawList(rect, widget, focused); - drawList(core::rect(widget->m_x, widget->m_y, widget->m_x + widget->m_w, widget->m_y + widget->m_h), - widget, focused); - - /* - if (((ListWidget*)widget)->getHeader().size() > 0) - { - drawListHeader(core::rect(widget->m_x, widget->m_y, widget->m_x + widget->m_w, rect.UpperLeftCorner.Y), - widget); - } - */ - + drawList(core::recti(widget->m_x, widget->m_y, + widget->m_x + widget->m_w, + widget->m_y + widget->m_h), + widget, focused); } else if (type == WTYPE_BUBBLE) { @@ -1790,7 +2056,7 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f } } - core::rect< s32 > rect2 = rect; + core::recti rect2 = rect; // minor adjustments... //rect2.UpperLeftCorner.X -= 7; @@ -1798,18 +2064,15 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f rect2.LowerRightCorner.X += BUBBLE_MARGIN_ON_RIGHT; if (bubble->isFocusedForPlayer(PLAYER_ID_GAME_MASTER)) - drawBoxFromStretchableTexture(widget, rect2, SkinConfig::m_render_params["textbubble::focused"]); + drawBoxFromStretchableTexture(widget, rect2, + SkinConfig::m_render_params["textbubble::focused"]); else - drawBoxFromStretchableTexture(widget, rect2, SkinConfig::m_render_params["textbubble::neutral"]); + drawBoxFromStretchableTexture(widget, rect2, + SkinConfig::m_render_params["textbubble::neutral"]); return; } - - //if(focused) - // GUIEngine::getDriver()->draw2DRectangle( SColor(255, 150, 0, 0), rect ); - //else - // GUIEngine::getDriver()->draw2DRectangle( SColor(255, 0, 150, 0), rect ); -} +} // draw3DSunkenPane // ----------------------------------------------------------------------------- @@ -1817,94 +2080,109 @@ void Skin::drawBGFadeColor() { // fade out background SColor color = SkinConfig::m_colors["dialog_background::neutral"]; - if (m_dialog_size < 1.0f) color.setAlpha( (unsigned int)(color.getAlpha()*m_dialog_size )); + if (m_dialog_size < 1.0f) + color.setAlpha( (unsigned int)(color.getAlpha()*m_dialog_size )); GUIEngine::getDriver()->draw2DRectangle( color, - core::rect< s32 >(position2d< s32 >(0,0) , - GUIEngine::getDriver()->getCurrentRenderTargetSize()) ); -} + core::recti(position2d< s32 >(0,0), + GUIEngine::getDriver()->getCurrentRenderTargetSize()) ); +} // drawBGFadeColor // ----------------------------------------------------------------------------- -core::rect< s32 > Skin::draw3DWindowBackground(IGUIElement *element, bool drawTitleBar, - video::SColor titleBarColor, - const core::rect< s32 > &rect, - const core::rect< s32 > *clip, - core::rect* checkClientArea) +core::recti Skin::draw3DWindowBackground(IGUIElement *element, + bool drawTitleBar, + video::SColor titleBarColor, + const core::recti &rect, + const core::recti *clip, + core::recti* checkClientArea) { drawBGFadeColor(); // draw frame if (m_dialog_size < 1.0f) { - core::rect< s32 > sized_rect = rect; + core::recti sized_rect = rect; core::position2d center = sized_rect.getCenter(); const int w = sized_rect.getWidth(); const int h = sized_rect.getHeight(); const float texture_size = sin(m_dialog_size*M_PI*0.5f); - sized_rect.UpperLeftCorner.X = (int)(center.X - (w/2.0f)*texture_size); - sized_rect.UpperLeftCorner.Y = (int)(center.Y - (h/2.0f)*texture_size); - sized_rect.LowerRightCorner.X = (int)(center.X + (w/2.0f)*texture_size); - sized_rect.LowerRightCorner.Y = (int)(center.Y + (h/2.0f)*texture_size); - drawBoxFromStretchableTexture( ModalDialog::getCurrent(), sized_rect, SkinConfig::m_render_params["window::neutral"]); + sized_rect.UpperLeftCorner.X = (int)(center.X -(w/2.0f)*texture_size); + sized_rect.UpperLeftCorner.Y = (int)(center.Y -(h/2.0f)*texture_size); + sized_rect.LowerRightCorner.X = (int)(center.X +(w/2.0f)*texture_size); + sized_rect.LowerRightCorner.Y = (int)(center.Y +(h/2.0f)*texture_size); + drawBoxFromStretchableTexture( ModalDialog::getCurrent(), sized_rect, + SkinConfig::m_render_params["window::neutral"]); m_dialog_size += GUIEngine::getLatestDt()*5; } else { - drawBoxFromStretchableTexture( ModalDialog::getCurrent(), rect, SkinConfig::m_render_params["window::neutral"]); + drawBoxFromStretchableTexture( ModalDialog::getCurrent(), rect, + SkinConfig::m_render_params["window::neutral"]); } return rect; -} +} // draw3DWindowBackground // ----------------------------------------------------------------------------- -void Skin::draw3DMenuPane (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip) +void Skin::draw3DMenuPane (IGUIElement *element, const core::recti &rect, + const core::recti *clip) { //printf("draw menu pane\n"); -} +} // draw3DMenuPane // ----------------------------------------------------------------------------- -void Skin::draw3DTabBody (IGUIElement *element, bool border, bool background, const core::rect< s32 > &rect, const core::rect< s32 > *clip, s32 tabHeight, gui::EGUI_ALIGNMENT alignment) +void Skin::draw3DTabBody (IGUIElement *element, bool border, bool background, + const core::recti &rect, const core::recti *clip, + s32 tabHeight, gui::EGUI_ALIGNMENT alignment) { //printf("draw tab body\n"); -} +} // draw3DTabBody // ----------------------------------------------------------------------------- -void Skin::draw3DTabButton (IGUIElement *element, bool active, const core::rect< s32 > &rect, const core::rect< s32 > *clip, gui::EGUI_ALIGNMENT alignment) +void Skin::draw3DTabButton (IGUIElement *element, bool active, + const core::recti &rect, const core::recti *clip, + gui::EGUI_ALIGNMENT alignment) { //printf("draw tab button\n"); -} +} // draw3DTabButton // ----------------------------------------------------------------------------- -void Skin::draw3DToolBar (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip) +void Skin::draw3DToolBar (IGUIElement *element, const core::recti &rect, + const core::recti *clip) { -} +} // draw3DToolBar // ----------------------------------------------------------------------------- ITexture* Skin::getImage(const char* name) { - if (SkinConfig::m_render_params.find(name) != SkinConfig::m_render_params.end()) + if (SkinConfig::m_render_params.find(name) + != SkinConfig::m_render_params.end()) { BoxRenderParams& p = SkinConfig::m_render_params[name]; return p.getImage(); } else { - return irr_driver->getTexture(file_manager->getDataDir() + "/gui/main_help.png"); + return irr_driver->getTexture( + file_manager->getDataDir() + "/gui/main_help.png"); } -} +} // getImage // ----------------------------------------------------------------------------- -void Skin::drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon, const core::position2di position, u32 starttime, u32 currenttime, bool loop, const core::rect< s32 > *clip) +void Skin::drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon, + const core::position2di position, u32 starttime, + u32 currenttime, bool loop, const core::recti *clip) { // we won't let irrLicht decide when to call this, we draw them ourselves. - /* m_fallback_skin->drawIcon(element, icon, position, starttime, currenttime, loop, clip); */ + /* m_fallback_skin->drawIcon(element, icon, position, starttime, + currenttime, loop, clip); */ } // ----------------------------------------------------------------------------- @@ -1913,13 +2191,18 @@ video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const { /* EGDC_3D_DARK_SHADOW Dark shadow for three-dimensional display elements. - EGDC_3D_SHADOW Shadow color for three-dimensional display elements (for edges facing away from the light source). - EGDC_3D_FACE Face color for three-dimensional display elements and for dialog box backgrounds. - EGDC_3D_HIGH_LIGHT Highlight color for three-dimensional display elements (for edges facing the light source.). - EGDC_3D_LIGHT Light color for three-dimensional display elements (for edges facing the light source.). + EGDC_3D_SHADOW Shadow color for three-dimensional display elements + (for edges facing away from the light source). + EGDC_3D_FACE Face color for three-dimensional display elements and for + dialog box backgrounds. + EGDC_3D_HIGH_LIGHT Highlight color for three-dimensional display + elements (for edges facing the light source.). + EGDC_3D_LIGHT Light color for three-dimensional display elements (for + edges facing the light source.). EGDC_ACTIVE_BORDER Active window border. EGDC_ACTIVE_CAPTION Active window title bar text. - EGDC_APP_WORKSPACE Background color of multiple document interface (MDI) applications. + EGDC_APP_WORKSPACE Background color of multiple document interface + (MDI) applications. EGDC_BUTTON_TEXT Text on a button. EGDC_GRAY_TEXT Grayed (disabled) text. EGDC_HIGH_LIGHT Item(s) selected in a control. @@ -1930,7 +2213,8 @@ video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const EGDC_TOOLTIP_BACKGROUND Tool tip background color. EGDC_SCROLLBAR Scrollbar gray area. EGDC_WINDOW Window background. - EGDC_WINDOW_SYMBOL Window symbols like on close buttons, scroll bars and check boxes. + EGDC_WINDOW_SYMBOL Window symbols like on close buttons, scroll bars + and check boxes. EGDC_ICON Icons in a list or tree. EGDC_ICON_HIGH_LIGHT Selected icons in a list or tree. */ @@ -1951,7 +2235,7 @@ video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const return SkinConfig::m_colors["text::neutral"]; } -} +} // getColor // ----------------------------------------------------------------------------- @@ -1959,14 +2243,14 @@ const wchar_t* Skin::getDefaultText (EGUI_DEFAULT_TEXT text) const { // No idea what this is for return L"SuperTuxKart"; -} +} // getDefaultText // ----------------------------------------------------------------------------- IGUIFont* Skin::getFont (EGUI_DEFAULT_FONT which) const { return GUIEngine::getFont(); -} +} // getFont // ----------------------------------------------------------------------------- @@ -2003,21 +2287,21 @@ void Skin::setColor (EGUI_DEFAULT_COLOR which, video::SColor newColor) void Skin::setDefaultText (EGUI_DEFAULT_TEXT which, const wchar_t *newText) { m_fallback_skin->setDefaultText(which, newText); -} +} // setDefaultText // ----------------------------------------------------------------------------- void Skin::setFont (IGUIFont *font, EGUI_DEFAULT_FONT which) { m_fallback_skin->setFont(font, which); -} +} // setFont // ----------------------------------------------------------------------------- void Skin::setIcon (EGUI_DEFAULT_ICON icon, u32 index) { m_fallback_skin->setIcon(icon, index); -} +} // setIcon // ----------------------------------------------------------------------------- @@ -2025,7 +2309,7 @@ void Skin::setSize (EGUI_DEFAULT_SIZE which, s32 texture_size) { m_fallback_skin->setSize(which, texture_size); //printf("setting size\n"); -} +} // setSize // ----------------------------------------------------------------------------- @@ -2034,4 +2318,4 @@ void Skin::setSpriteBank (IGUISpriteBank *bank) //printf("setting sprite bank\n"); m_fallback_skin->setSpriteBank(bank); //this->m_bank = bank; -} +} // setSpriteBank