void OsuUserStatsScreen::draw(Graphics *g) { if (!m_bVisible) return; if (m_vInfoText.size() > 0) { const float infoScale = 0.1f; const float paddingScale = 0.4f; McFont *infoFont = m_osu->getSubTitleFont(); g->setColor(0xff888888); for (int i=0; i<m_vInfoText.size(); i++) { g->pushTransform(); { const float scale = (m_scores->getPos().y / infoFont->getHeight())*infoScale; const float height = infoFont->getHeight()*scale; const float padding = height*paddingScale; g->scale(scale, scale); g->translate(m_userButton->getPos().x + m_userButton->getSize().x + 10, m_scores->getPos().y/2 + height/2 - ((m_vInfoText.size()-1)*height + (m_vInfoText.size()-1)*padding)/2 + i*(height+padding)); g->drawString(infoFont, m_vInfoText[i]); } g->popTransform(); } } m_container->draw(g); OsuScreenBackable::draw(g); }
void OsuMainMenu::draw(Graphics *g) { if (!m_bVisible) return; McFont *smallFont = engine->getResourceManager()->getFont("FONT_DEFAULT"); McFont *titleFont = m_osu->getTitleFont(); // draw banner /* float bannerStringWidth = smallFont->getStringWidth(MCOSU_BANNER); int bannerDiff = 20; int bannerMargin = 5; int numBanners = (int)roundf(Osu::getScreenWidth() / (bannerStringWidth + bannerDiff)) + 2; g->setColor(0xff777777); g->pushTransform(); g->translate(1, 1); for (int i=-1; i<numBanners; i++) { g->pushTransform(); g->translate(i*bannerStringWidth + i*bannerDiff + fmod(engine->getTime()*30, bannerStringWidth + bannerDiff), smallFont->getHeight() + bannerMargin); g->drawString(smallFont, MCOSU_BANNER); g->popTransform(); } g->popTransform(); g->setColor(0xff333333); for (int i=-1; i<numBanners; i++) { g->pushTransform(); g->translate(i*bannerStringWidth + i*bannerDiff + fmod(engine->getTime()*30, bannerStringWidth + bannerDiff), smallFont->getHeight() + bannerMargin); g->drawString(smallFont, MCOSU_BANNER); g->popTransform(); } */ // draw todolist g->setColor(0xff777777); g->pushTransform(); g->translate(7, Osu::getScreenHeight()/2 - smallFont->getHeight()/2); g->drawString(smallFont, "TODO:"); g->translate(0, 10); for (int i=0; i<m_todo.size(); i++) { g->translate(0, smallFont->getHeight()+5); g->drawString(smallFont, m_todo[i]); } g->popTransform(); // draw container m_container->draw(g); // draw main button text overlay (+ pulse rect anim) // HACKHACK: redo this properly, with an image or something const float div = 1.25f; const float pulse = (div - fmod(engine->getTime(), div))/div; //pulse *= pulse; // quadratic Vector2 size = m_vSize; const float pulseSub = 0.05f*pulse; size -= size*pulseSub; size += size*m_fSizeAddAnim; Rect rect = Rect(m_vCenter.x - size.x/2.0f - m_fCenterOffsetAnim, m_vCenter.y - size.y/2.0f, size.x, size.y); g->setColor(0xff000000); g->fillRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()); g->setColor(0xffffffff); g->drawRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()); g->setColor(0xffffffff); float fontScale = 1.0f - pulseSub + m_fSizeAddAnim; //fontScale *= 2; UString title = "McOsu!"; g->pushTransform(); g->scale(fontScale, fontScale); g->translate(m_vCenter.x - m_fCenterOffsetAnim - (titleFont->getStringWidth(title)/2.0f)*fontScale, m_vCenter.y + (titleFont->getHeight()*fontScale)/2.25f); g->drawString(titleFont, title); g->popTransform(); drawVersionInfo(g); }
void OsuUISongBrowserScoreButton::draw(Graphics *g) { if (!m_bVisible) return; // background if (m_style == STYLE::SCORE_BROWSER) { g->setColor(0xff000000); g->setAlpha(0.59f * (0.5f + 0.5f*m_fIndexNumberAnim)); Image *backgroundImage = m_osu->getSkin()->getMenuButtonBackground(); g->pushTransform(); { // allow overscale Vector2 hardcodedImageSize = Vector2(699.0f, 103.0f)*(m_osu->getSkin()->isMenuButtonBackground2x() ? 2.0f : 1.0f); const float scale = Osu::getImageScaleToFillResolution(hardcodedImageSize, m_vSize); g->scale(scale, scale); g->translate(m_vPos.x + hardcodedImageSize.x*scale/2.0f, m_vPos.y + hardcodedImageSize.y*scale/2.0f); g->drawImage(backgroundImage); } g->popTransform(); } else if (m_style == STYLE::TOP_RANKS) { g->setColor(0xff666666); // from 33413c to 4e7466 g->setAlpha(0.59f * (0.5f + 0.5f*m_fIndexNumberAnim)); g->fillRect(m_vPos.x, m_vPos.y, m_vSize.x, m_vSize.y); } const int yPos = (int)m_vPos.y; // avoid max shimmering // index number const float indexNumberScale = 0.35f; const float indexNumberWidthPercent = (m_style == STYLE::TOP_RANKS ? 0.075f : 0.15f); McFont *indexNumberFont = m_osu->getSongBrowserFontBold(); g->pushTransform(); { UString indexNumberString = UString::format("%i", m_iScoreIndexNumber); const float scale = (m_vSize.y / indexNumberFont->getHeight())*indexNumberScale; g->scale(scale, scale); g->translate((int)(m_vPos.x + m_vSize.x*indexNumberWidthPercent*0.5f - indexNumberFont->getStringWidth(indexNumberString)*scale/2.0f), (int)(yPos + m_vSize.y/2.0f + indexNumberFont->getHeight()*scale/2.0f)); g->translate(0.5f, 0.5f); g->setColor(0xff000000); g->setAlpha(1.0f - (1.0f - m_fIndexNumberAnim)); g->drawString(indexNumberFont, indexNumberString); g->translate(-0.5f, -0.5f); g->setColor(0xffffffff); g->setAlpha(1.0f - (1.0f - m_fIndexNumberAnim)*(1.0f - m_fIndexNumberAnim)); g->drawString(indexNumberFont, indexNumberString); } g->popTransform(); // grade const float gradeHeightPercent = 0.7f; OsuSkinImage *grade = getGradeImage(m_osu, m_scoreGrade); int gradeWidth = 0; g->pushTransform(); { const float scale = Osu::getImageScaleToFitResolution(grade->getSizeBaseRaw(), Vector2(m_vSize.x * (1.0f - indexNumberWidthPercent), m_vSize.y*gradeHeightPercent)); gradeWidth = grade->getSizeBaseRaw().x*scale; g->setColor(0xffffffff); grade->drawRaw(g, Vector2((int)(m_vPos.x + m_vSize.x*indexNumberWidthPercent + gradeWidth/2.0f), (int)(m_vPos.y + m_vSize.y/2.0f)), scale); } g->popTransform(); const float gradePaddingRight = m_vSize.y * 0.165f; // username | (artist + songName + diffName) const float usernameScale = (m_style == STYLE::TOP_RANKS ? 0.6f : 0.7f); McFont *usernameFont = m_osu->getSongBrowserFont(); g->pushClipRect(McRect(m_vPos.x, m_vPos.y, m_vSize.x, m_vSize.y)); g->pushTransform(); { const float height = m_vSize.y*0.5f; const float paddingTopPercent = (1.0f - usernameScale)*(m_style == STYLE::TOP_RANKS ? 0.15f : 0.4f); const float paddingTop = height*paddingTopPercent; const float scale = (height / usernameFont->getHeight())*usernameScale; UString &string = (m_style == STYLE::TOP_RANKS ? m_sScoreTitle : m_sScoreUsername); g->scale(scale, scale); g->translate((int)(m_vPos.x + m_vSize.x*indexNumberWidthPercent + gradeWidth + gradePaddingRight), (int)(yPos + height/2.0f + usernameFont->getHeight()*scale/2.0f + paddingTop)); g->translate(0.75f, 0.75f); g->setColor(0xff000000); g->setAlpha(0.75f); g->drawString(usernameFont, string); g->translate(-0.75f, -0.75f); g->setColor(0xffffffff); g->drawString(usernameFont, string); } g->popTransform(); g->popClipRect(); // score | pp | weighted 95% (pp) const float scoreScale = 0.5f; McFont *scoreFont = (m_vSize.y < 50 ? engine->getResourceManager()->getFont("FONT_DEFAULT") : usernameFont); // HACKHACK g->pushTransform(); { const float height = m_vSize.y*0.5f; const float paddingBottomPercent = (1.0f - scoreScale)*(m_style == STYLE::TOP_RANKS ? 0.1f : 0.25f); const float paddingBottom = height*paddingBottomPercent; const float scale = (height / scoreFont->getHeight())*scoreScale; UString &string = (m_style == STYLE::TOP_RANKS ? m_sScoreScorePPWeightedPP : m_sScoreScorePP); g->scale(scale, scale); g->translate((int)(m_vPos.x + m_vSize.x*indexNumberWidthPercent + gradeWidth + gradePaddingRight), (int)(yPos + height*1.5f + scoreFont->getHeight()*scale/2.0f - paddingBottom)); g->translate(0.75f, 0.75f); g->setColor(0xff000000); g->setAlpha(0.75f); g->drawString(scoreFont, (m_osu_scores_sort_by_pp->getBool() && !m_score.isLegacyScore ? string : m_sScoreScore)); g->translate(-0.75f, -0.75f); g->setColor((m_style == STYLE::TOP_RANKS ? 0xffdeff87 : 0xffffffff)); g->drawString(scoreFont, (m_osu_scores_sort_by_pp->getBool() && !m_score.isLegacyScore ? string : m_sScoreScore)); if (m_style == STYLE::TOP_RANKS) { g->translate(scoreFont->getStringWidth(string)*scale, 0); g->translate(0.75f, 0.75f); g->setColor(0xff000000); g->setAlpha(0.75f); g->drawString(scoreFont, m_sScoreScorePPWeightedWeight); g->translate(-0.75f, -0.75f); g->setColor(0xffbbbbbb); g->drawString(scoreFont, m_sScoreScorePPWeightedWeight); } } g->popTransform(); const float rightSideThirdHeight = m_vSize.y*0.333f; const float rightSidePaddingRight = (m_style == STYLE::TOP_RANKS ? 5 : m_vSize.x*0.025f); // mods const float modScale = 0.7f; McFont *modFont = m_osu->getSubTitleFont(); g->pushTransform(); { const float height = rightSideThirdHeight; const float paddingTopPercent = (1.0f - modScale)*0.45f; const float paddingTop = height*paddingTopPercent; const float scale = (height / modFont->getHeight())*modScale; g->scale(scale, scale); g->translate((int)(m_vPos.x + m_vSize.x - modFont->getStringWidth(m_sScoreMods)*scale - rightSidePaddingRight), (int)(yPos + height*0.5f + modFont->getHeight()*scale/2.0f + paddingTop)); g->translate(0.75f, 0.75f); g->setColor(0xff000000); g->setAlpha(0.75f); g->drawString(modFont, m_sScoreMods); g->translate(-0.75f, -0.75f); g->setColor(0xffffffff); g->drawString(modFont, m_sScoreMods); } g->popTransform(); // accuracy const float accScale = 0.65f; McFont *accFont = m_osu->getSubTitleFont(); g->pushTransform(); { const float height = rightSideThirdHeight; const float paddingTopPercent = (1.0f - modScale)*0.45f; const float paddingTop = height*paddingTopPercent; const float scale = (height / accFont->getHeight())*accScale; g->scale(scale, scale); g->translate((int)(m_vPos.x + m_vSize.x - accFont->getStringWidth(m_sScoreAccuracy)*scale - rightSidePaddingRight), (int)(yPos + height*1.5f + accFont->getHeight()*scale/2.0f + paddingTop)); g->translate(0.75f, 0.75f); g->setColor(0xff000000); g->setAlpha(0.75f); g->drawString(accFont, m_sScoreAccuracy); g->translate(-0.75f, -0.75f); g->setColor((m_style == STYLE::TOP_RANKS ? 0xffffcc22 : 0xffffffff)); g->drawString(accFont, m_sScoreAccuracy); } g->popTransform(); if (m_style == STYLE::TOP_RANKS) { // weighted percent const float weightScale = 0.65f; McFont *weightFont = m_osu->getSubTitleFont(); g->pushTransform(); { const float height = rightSideThirdHeight; const float paddingBottomPercent = (1.0f - weightScale)*0.05f; const float paddingBottom = height*paddingBottomPercent; const float scale = (height / weightFont->getHeight())*weightScale; g->scale(scale, scale); g->translate((int)(m_vPos.x + m_vSize.x - weightFont->getStringWidth(m_sScoreWeight)*scale - rightSidePaddingRight), (int)(yPos + height*2.5f + weightFont->getHeight()*scale/2.0f - paddingBottom)); g->translate(0.75f, 0.75f); g->setColor(0xff000000); g->setAlpha(0.75f); g->drawString(weightFont, m_sScoreWeight); g->translate(-0.75f, -0.75f); g->setColor(0xff999999); g->drawString(weightFont, m_sScoreWeight); } g->popTransform(); } // recent icon + elapsed time since score const float upIconScale = 0.35f; const float timeElapsedScale = accScale; McFont *iconFont = m_osu->getFontIcons(); McFont *timeFont = accFont; if (m_iScoreUnixTimestamp > 0) { const float iconScale = (m_vSize.y / iconFont->getHeight())*upIconScale; const float iconHeight = iconFont->getHeight()*iconScale; const float iconPaddingLeft = 2 + (m_style == STYLE::TOP_RANKS ? m_vSize.y*0.125f : 0); g->pushTransform(); { g->scale(iconScale, iconScale); g->translate((int)(m_vPos.x + m_vSize.x + iconPaddingLeft), (int)(yPos + m_vSize.y/2 + iconHeight/2)); g->translate(1, 1); g->setColor(0xff000000); g->setAlpha(0.75f); g->drawString(iconFont, recentScoreIconString); g->translate(-1, -1); g->setColor(0xffffffff); g->drawString(iconFont, recentScoreIconString); } g->popTransform(); // elapsed time since score if (m_sScoreTime.length() > 0) { const float timeHeight = rightSideThirdHeight; const float timeScale = (timeHeight / timeFont->getHeight())*timeElapsedScale; const float timePaddingLeft = 8; g->pushTransform(); { g->scale(timeScale, timeScale); g->translate((int)(m_vPos.x + m_vSize.x + iconPaddingLeft + iconFont->getStringWidth(recentScoreIconString)*iconScale + timePaddingLeft), (int)(yPos + m_vSize.y/2 + timeFont->getHeight()*timeScale/2)); g->translate(0.75f, 0.75f); g->setColor(0xff000000); g->setAlpha(0.85f); g->drawString(timeFont, m_sScoreTime); g->translate(-0.75f, -0.75f); g->setColor(0xffffffff); g->drawString(timeFont, m_sScoreTime); } g->popTransform(); } } // TODO: difference to below score in list, +12345 if (m_style == STYLE::TOP_RANKS) { g->setColor(0xff111111); g->drawRect(m_vPos.x, m_vPos.y, m_vSize.x, m_vSize.y); } }