The server tree of https://code.moenext.com/nanahira/ygopro.git, branch server, commit 52c868ce071ea0f2fcb0cf39bf2fb4151d12b90c, stock: gframe/, premake5.lua, .ci/, LICENSE, and gframe/ygopro.rc + .ico (upstream keeps them in resource/ and copies them in before building). No game assets, no scripts, no ocgcore submodule: the core is ../core. The third-party sources upstream's Windows CI downloads are vendored here at the positions its premake expects, each with its premake fragment from upstream's premake/ folder inside it: lua 5.4.8, sqlite 3.53.3, libevent 2.1.13-stable (tests, samples and autotools helpers left out; the files its Windows prebuild copies into include/ left out), zlib 1.3.2 (contrib and examples left out), xz 5.8.3 (src/liblzma + src/common only), and irrlicht 1.9 from mycard at 20f86d25: include/ plus the source/Irrlicht headers and the 11 .cpp files the server's zip reader project compiles. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
89 lines
2.3 KiB
C++
89 lines
2.3 KiB
C++
#include "CGUIProgressBar.h"
|
|
#include <IGUIEnvironment.h>
|
|
#include "CImageGUISkin.h"
|
|
#include <IGUIFont.h>
|
|
|
|
namespace irr
|
|
{
|
|
namespace gui
|
|
{
|
|
|
|
CGUIProgressBar::CGUIProgressBar( IGUIElement* parent, IGUIEnvironment* environment, const core::rect<s32>& rectangle, s32 id,bool bind )
|
|
: IGUIElement( EGUIET_ELEMENT, environment, parent, id, rectangle )
|
|
{
|
|
FilledRatio = 0.0f;
|
|
FillColor = video::SColor(255,255,0,0);
|
|
EmptyColor = video::SColor();
|
|
AutomaticTextFormat = L"%2.0f %%";
|
|
bindColorsToSkin = bind;
|
|
}
|
|
|
|
void CGUIProgressBar::setAutomaticText( const wchar_t* text )
|
|
{
|
|
AutomaticTextFormat = text? text:L"";
|
|
if ( AutomaticTextFormat != L"" )
|
|
{
|
|
wchar_t* buffer = new wchar_t[ AutomaticTextFormat.size() + 10 ];
|
|
swprintf( buffer, AutomaticTextFormat.size() + 10, AutomaticTextFormat.c_str(), 100*FilledRatio );
|
|
Text = buffer;
|
|
delete buffer;
|
|
}
|
|
}
|
|
|
|
void CGUIProgressBar::setFillColor( video::SColor fill )
|
|
{
|
|
FillColor = fill;
|
|
}
|
|
|
|
video::SColor CGUIProgressBar::getFillColor() const
|
|
{
|
|
return FillColor;
|
|
}
|
|
|
|
void CGUIProgressBar::setEmptyColor( video::SColor empty )
|
|
{
|
|
EmptyColor = empty;
|
|
}
|
|
|
|
video::SColor CGUIProgressBar::getEmptyColor() const
|
|
{
|
|
return EmptyColor;
|
|
}
|
|
|
|
|
|
void CGUIProgressBar::setProgress( f32 progress )
|
|
{
|
|
FilledRatio = progress;
|
|
if ( AutomaticTextFormat != L"" )
|
|
{
|
|
wchar_t* buffer = new wchar_t[ AutomaticTextFormat.size() + 10 ];
|
|
swprintf( buffer, AutomaticTextFormat.size() + 10, AutomaticTextFormat.c_str(), 100*FilledRatio );
|
|
Text = buffer;
|
|
delete buffer;
|
|
}
|
|
}
|
|
|
|
f32 CGUIProgressBar::getProgress() const
|
|
{
|
|
return FilledRatio;
|
|
}
|
|
|
|
void CGUIProgressBar::draw()
|
|
{
|
|
CImageGUISkin* skin = static_cast<CImageGUISkin*>( Environment->getSkin() );
|
|
// Madoc added these changes to let the progress bar get its fill colors from the skin
|
|
if(bindColorsToSkin) {
|
|
EmptyColor = ((gui::SImageGUISkinConfig)skin->getConfig()).ProgressBar.Color;
|
|
FillColor = ((gui::SImageGUISkinConfig)skin->getConfig()).ProgressBarFilled.Color;
|
|
}
|
|
// End Madoc changes
|
|
skin->drawHorizontalProgressBar( this, AbsoluteRect, &AbsoluteClippingRect, FilledRatio, FillColor, EmptyColor );
|
|
|
|
// Draw text in center
|
|
skin->getFont(EGDF_DEFAULT)->draw( Text.c_str(), AbsoluteRect, skin->getColor(EGDC_BUTTON_TEXT), true, true, &AbsoluteClippingRect );
|
|
}
|
|
|
|
}
|
|
}
|
|
|