add initial examples, replacing the 'Demos/Demos3'. Will make it work cross-platform, OpenGL3/OpenGL2 and add more examples to it.

This commit is contained in:
erwincoumans
2015-04-16 09:55:32 -07:00
parent d9feaf2d2a
commit a1bf9c5556
425 changed files with 255913 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
/*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#include "Gwen/Controls/ScrollControl.h"
#include "Gwen/Controls/ProgressBar.h"
#include "Gwen/Utility.h"
using namespace Gwen;
using namespace Gwen::Controls;
GWEN_CONTROL_CONSTRUCTOR( ProgressBar )
{
SetMouseInputEnabled( true );
SetBounds( Gwen::Rect( 0, 0, 128, 32 ) );
SetTextPadding( Padding( 3, 3, 3, 3 ) );
SetHorizontal();
SetAlignment( Gwen::Pos::Center );
m_fProgress = 0.0f;
m_bAutoLabel = true;
}
void ProgressBar::SetValue(float val)
{
if ( val < 0 )
val = 0;
if ( val > 1 )
val = 1;
m_fProgress = val;
if ( m_bAutoLabel )
{
int displayVal = m_fProgress * 100;
SetText( Utility::ToString( displayVal ) + "%" );
}
}
void ProgressBar::Render( Skin::Base* skin )
{
skin->DrawProgressBar( this, m_bHorizontal, m_fProgress);
}