• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

HP bars in PNG

bwagra

New Member
Joined
Jan 14, 2021
Messages
1
Reaction score
0
hello trying to make hp bars in png

I have the main HP template in png and the current %HP bar also in PNG (I tried differently that there is a template first and it shows HP from the current client but I have a transparent background and it does not look good)

Example c++
C++:
TexturePtr bgLifeBar= g_textures.getTexture("/images/game/hp/bar.png");
g_painter->drawTexturedRect(backgroundRect, bgLifeBar);
TexturePtr bgLifeBarUI = g_textures.getTexture("/images/game/hp/bar_precent.png");
int width = (int)((m_healthPercent / 100.0) * bgLifeBarUI->getWidth());
g_painter->drawTexturedRect(backgroundRect, bgLifeBarUI, Rect(0, 0, width, bgLifeBarUI->getHeight()));

i'm looking for an idea for cutting a PNG HP% at back and but not resize

FULL HP:
~50% HP
 

Bakasura

Member
Joined
Jan 20, 2019
Messages
18
Solutions
1
Reaction score
22
See drawImage function in framework/ui/uiwidgetimage.cpp. There you have the built-in way to clip images without resizing them.
 

Oskar1121

Veteran OT User
Joined
Jul 15, 2009
Messages
597
Reaction score
399
Location
Poland
Or just draw colourful rectangle under hp bar. Use your image as a frame and draw them on rectangle.
 
Top