Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void graphics::printExperienceBar(int nSurface, int index)
- {
- int pos = tibiaClient::HUDItemInformation[index].position;
- int height, width, top, left; //the - 5 * 2 is because of spacing, so is - height * 2
- if (pos == Consts::HUD_POSITION_MAIN_TOPLEFT || pos == Consts::HUD_POSITION_MAIN_TOPRIGHT)
- {
- top = tibiaClient::HUDItemInformation[index].yOffset;
- width = 5;
- if (pos == Consts::HUD_POSITION_MAIN_TOPRIGHT)
- left = graphics::gameWindowInfo.left + graphics::gameWindowInfo.right - width - tibiaClient::HUDItemInformation[index].xOffset;
- else
- left = tibiaClient::HUDItemInformation[index].xOffset;
- height = (graphics::gameWindowInfo.bottom + graphics::gameWindowInfo.top) - tibiaClient::HUDItemInformation[index].yOffset * 2;
- }
- else if (pos == Consts::HUD_POSITION_GAME_TOPLEFT || pos == Consts::HUD_POSITION_GAME_TOPRIGHT)
- {
- top = graphics::gameWindowInfo.top + tibiaClient::HUDItemInformation[index].yOffset;
- width = 5;
- if (pos == Consts::HUD_POSITION_GAME_TOPRIGHT)
- left = graphics::gameWindowInfo.right - width - tibiaClient::HUDItemInformation[index].xOffset;
- else
- left = graphics::gameWindowInfo.left + tibiaClient::HUDItemInformation[index].xOffset;
- height = graphics::gameWindowInfo.height - tibiaClient::HUDItemInformation[index].yOffset * 2;
- }
- else
- {
- height = 5;
- if (pos == Consts::HUD_POSITION_GAME_BOTTOMMIDDLE)
- top = graphics::gameWindowInfo.bottom - height - tibiaClient::HUDItemInformation[index].yOffset;
- else
- top = graphics::gameWindowInfo.top + tibiaClient::HUDItemInformation[index].yOffset;
- left = graphics::gameWindowInfo.left + tibiaClient::HUDItemInformation[index].xOffset;
- width = graphics::gameWindowInfo.width - tibiaClient::HUDItemInformation[index].xOffset * 2;
- }
- int barSize = (int)(((float)maxval(height, width) / 100.0f) * tibiaClient::Self->LevelPercent);
- int markIncrement = (maxval(height, width) / 4);
- tibiaClient::PrintSkin(1, left, top, width, height, Consts::Gui_Background_Regular); //back
- if (width > height) //bar
- tibiaClient::PrintRect(1, left, top, barSize, height,
- tibiaClient::HUDItemInformation[index].textColor.R,
- tibiaClient::HUDItemInformation[index].textColor.G,
- tibiaClient::HUDItemInformation[index].textColor.B);
- else
- tibiaClient::PrintRect(1, left, top + (height - barSize), width, barSize,
- tibiaClient::HUDItemInformation[index].textColor.R,
- tibiaClient::HUDItemInformation[index].textColor.G,
- tibiaClient::HUDItemInformation[index].textColor.B); //bar
- tibiaClient::PrintSkin(1, left, top, width, 1, Consts::Gui_Border_Top_And_Left); //top
- tibiaClient::PrintSkin(1, left, top+height, width, 1, Consts::Gui_Border_Bottom); //bottom
- tibiaClient::PrintSkin(1, left, top, 1, height, Consts::Gui_Border_Top_And_Left); //left
- tibiaClient::PrintSkin(1, left+width-1, top, 1, height, Consts::Gui_Border_Right); //right
- if (width > height) //bar
- {
- //mark 75%
- tibiaClient::PrintSkin(1, left + markIncrement - 1, top, 1, height, Consts::Gui_Border_Right);
- tibiaClient::PrintSkin(1, left + markIncrement, top, 1, height, Consts::Gui_Border_Top_And_Left);
- //mark 50%
- tibiaClient::PrintSkin(1, left + markIncrement*2 - 1, top, 1, height, Consts::Gui_Border_Right);
- tibiaClient::PrintSkin(1, left + markIncrement*2, top, 1, height, Consts::Gui_Border_Top_And_Left);
- //mark 25%
- tibiaClient::PrintSkin(1, left + markIncrement*3 - 1, top, 1, height, Consts::Gui_Border_Right);
- tibiaClient::PrintSkin(1, left + markIncrement*3, top, 1, height, Consts::Gui_Border_Top_And_Left);
- //std::stringstream str;
- //str << tibiaClient::Self->LevelPercent << "%";
- //tibiaClient::PrintText(nSurface,
- // left + barSize - 3,
- // top - 3,
- // Consts::FONT_NORMALBORDER,
- // tibiaClient::HUDItemInformation[index].textColor.R,
- // tibiaClient::HUDItemInformation[index].textColor.G,
- // tibiaClient::HUDItemInformation[index].textColor.B,
- // stringToChar(str.str()),
- // Consts::FONT_ALIGNMENT_RIGHT);
- }
- else
- {
- //mark 75%
- tibiaClient::PrintSkin(1, left, top + markIncrement - 1, width, 1, Consts::Gui_Border_Bottom);
- tibiaClient::PrintSkin(1, left, top + markIncrement, width, 1, Consts::Gui_Border_Top_And_Left);
- //mark 50%
- tibiaClient::PrintSkin(1, left, top + markIncrement*2 - 1, width, 1, Consts::Gui_Border_Bottom);
- tibiaClient::PrintSkin(1, left, top + markIncrement*2, width, 1, Consts::Gui_Border_Top_And_Left);
- //mark 25%
- tibiaClient::PrintSkin(1, left, top + markIncrement*3 - 1, width, 1, Consts::Gui_Border_Bottom);
- tibiaClient::PrintSkin(1, left, top + markIncrement*3, width, 1, Consts::Gui_Border_Top_And_Left);
- }
- }
Add Comment
Please, Sign In to add comment