void Upgrade::DrawUpgrade(Core::Graphics& graphics, Vector2D mouse, float thickness) { myColor = (CheckMouse(mouse))? RGB(134, 134, 134): RGB(94,94,94); if(upgradeCooldown < .5) { upgradeCooldown += .016f; } graphics.SetColor(myColor); for(int i=0; i<BOX_SIZE; i++) { Vector2D start(position.x + i, position.y); Vector2D end(position.x + i, position.y+BOX_SIZE); graphics.DrawLine(start.x, start.y, end.x, end.y); } if(CheckMouse(mouse)) { viewText(graphics); if(Core::Input::IsPressed(Core::Input::BUTTON_LEFT)&&upgradeCooldown >= .5f && myCash.getCash() >= upgradeCost && upgradeCount < 5) { upgradeCooldown = 0; myCash.decreaseCash(upgradeCost); upgradeCount++; } } SetUpgradeCost(); DrawGraphic(graphics); graphics.SetColor(RGB(255,255,255)); if(upgradeCount > 4) { graphics.SetColor(RGB(255,0,0)); } //Draws $ DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x, costPosition.y+thickness/2)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x, costPosition.y + thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x, costPosition.y+thickness+((Letter_Size-3*thickness)/2))); DrawVerticalBar(graphics, thickness,(Letter_Size-3*thickness)/2, Vector2D(costPosition.x+(Letter_Size-thickness), costPosition.y + thickness*2+((Letter_Size-3*thickness)/2))); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x, costPosition.y+2*thickness + (2*((Letter_Size-3*thickness)/2)-thickness/2))); DrawVerticalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+(Letter_Size/2.5f), costPosition.y)); //Draws Cost DrawLetters(graphics, thickness); }
void CASW_VGUI_Door_Tooltip::Paint() { BaseClass::Paint(); if (GetAlpha() > 0) { int padding = (2.0f / 1024.0f) * ScreenWidth(); if (padding < 1) padding = 1; int bar_width = (96.0f / 1024.0f) * ScreenWidth(); int bar_height = (12.0f / 1024.0f) * ScreenWidth(); DrawHorizontalBar( padding, padding, bar_width, bar_height, m_fDoorHealthFraction, 255, 255, 255, 255 ); if (GetWide() < bar_width + padding + padding) { SetWide(bar_width + padding + padding - 1); } SetTall( bar_height + padding + padding - 1); } }
void Upgrade::DrawLetters(Core::Graphics& graphics, float thickness) { char buf[50]; sprintf_s(buf, "%f", upgradeCost); graphics.DrawString(0,0, buf); atTheDot = false; int currentLetter = 1; for(int i=0; i<50; i++) { if(!atTheDot) { switch(buf[i]) { case('0'): DrawVerticalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap, costPosition.y)); DrawVerticalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+(Letter_Size-thickness), costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-2*thickness, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+thickness, costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-2*thickness, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+thickness, costPosition.y+(Letter_Size-thickness))); currentLetter++; break; case('1'): DrawHorizontalBar(graphics, thickness, (Letter_Size-thickness)/4, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+ (Letter_Size-thickness)/4, costPosition.y+(Letter_Size-thickness)/4)); DrawVerticalBar(graphics, thickness, Letter_Size-thickness, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+((Letter_Size-thickness)/2), costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness*2, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+(Letter_Size-thickness)/4, costPosition.y+Letter_Size-thickness)); currentLetter++; break; case('2'): DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y + thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+thickness+((Letter_Size-3*thickness)/2))); DrawVerticalBar(graphics, thickness,(Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y + thickness*2+((Letter_Size-3*thickness)/2))); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+2*thickness + 2*((Letter_Size-3*thickness)/2))); currentLetter++; break; case('3'): DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y + thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+thickness+((Letter_Size-3*thickness)/2))); DrawVerticalBar(graphics, thickness,(Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y + thickness*2+((Letter_Size-3*thickness)/2))); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+2*thickness + 2*((Letter_Size-3*thickness)/2))); currentLetter++; break; case('4'): DrawVerticalBar(graphics, thickness, ((Letter_Size-thickness)/2)+thickness, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap, costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness*2, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+thickness, costPosition.y+((Letter_Size-thickness)/2))); DrawVerticalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+currentLetter*Letter_Size+currentLetter*Letter_Gap+(Letter_Size-thickness), costPosition.y)); currentLetter++; break; case('5'): DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y + thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+thickness+((Letter_Size-3*thickness)/2))); DrawVerticalBar(graphics, thickness,(Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y + thickness*2+((Letter_Size-3*thickness)/2))); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+2*thickness + 2*((Letter_Size-3*thickness)/2))); currentLetter++; break; case('6'): DrawVerticalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+thickness, costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+thickness, costPosition.y+((Letter_Size-3*thickness)/2)+thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+thickness, costPosition.y+(Letter_Size-3*thickness)+2*thickness)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y+((Letter_Size-3*thickness)/2)+2*thickness)); currentLetter++; break; case('7'): DrawVerticalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+Letter_Size-thickness, costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y)); currentLetter++; break; case('8'): DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y + thickness)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+Letter_Size-thickness, costPosition.y + thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+thickness+((Letter_Size-3*thickness)/2))); DrawVerticalBar(graphics, thickness,(Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y + thickness*2+((Letter_Size-3*thickness)/2))); DrawVerticalBar(graphics, thickness,(Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y + thickness*2+((Letter_Size-3*thickness)/2))); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+2*thickness + 2*((Letter_Size-3*thickness)/2))); currentLetter++; break; case('9'): DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2+2*thickness, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+thickness, costPosition.y)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y+thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size-thickness, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+thickness, costPosition.y+((Letter_Size-3*thickness)/2)+thickness)); DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter, costPosition.y+(Letter_Size-3*thickness)+2*thickness)); DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x+Letter_Size*currentLetter+Letter_Gap*currentLetter+(Letter_Size-thickness), costPosition.y+((Letter_Size-3*thickness)/2)+2*thickness)); currentLetter++; break; case('.'): atTheDot=true; break; } } } }