CUGL 4.0
Cornell University Game Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cugl::scene2::ProgressBar Class Reference

#include <CUProgressBar.h>

Inheritance diagram for cugl::scene2::ProgressBar:
cugl::scene2::SceneNode

Public Member Functions

 ProgressBar ()
 
 ~ProgressBar ()
 
virtual void dispose () override
 
virtual bool init () override
 
bool initWithSize (const Size &size)
 
bool initWithTexture (const std::shared_ptr< graphics::Texture > &texture)
 
bool initWithTexture (const std::shared_ptr< graphics::Texture > &texture, const Size &size)
 
bool initWithCaps (const std::shared_ptr< graphics::Texture > &texture, float left, float right)
 
bool initWithCaps (const std::shared_ptr< graphics::Texture > &texture, float left, float right, const Size &size)
 
bool initWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data) override
 
float getProgress () const
 
void setProgress (float progress)
 
virtual void setContentSize (const Size &size) override
 
void setTexture (const std::string &filename)
 
void setTexture (const std::shared_ptr< graphics::Texture > &texture)
 
std::shared_ptr< graphics::TexturegetTexture ()
 
const std::shared_ptr< graphics::Texture > & getTexture () const
 
void setInterior (float left, float right)
 
void setInterior (const std::pair< float, float > interval)
 
const std::pair< float, float > getInterior () const
 
void setBlendMode (const graphics::BlendMode &mode)
 
void setBlendState (const graphics::BlendState &blend)
 
const graphics::BlendStategetBlendState () const
 
virtual std::string toString (bool verbose=false) const override
 
virtual void draw (const std::shared_ptr< graphics::SpriteBatch > &batch, const Affine2 &transform, Color4 tint) override
 
void refresh ()
 
- Public Member Functions inherited from cugl::scene2::SceneNode
 SceneNode ()
 
 ~SceneNode ()
 
virtual void dispose ()
 
virtual bool init ()
 
virtual bool initWithPosition (const Vec2 &pos)
 
bool initWithPosition (float x, float y)
 
virtual bool initWithBounds (const Size &size)
 
virtual bool initWithBounds (float width, float height)
 
virtual bool initWithBounds (const Rect &rect)
 
virtual bool initWithBounds (float x, float y, float width, float height)
 
virtual bool initWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data)
 
bool initForDrawableBounds ()
 
bool initForSafeBounds ()
 
virtual std::shared_ptr< SceneNodecopy (const std::shared_ptr< SceneNode > &dst) const
 
unsigned int getTag () const
 
void setTag (unsigned int tag)
 
const std::string getName () const
 
void setName (const std::string name)
 
const std::string getClassName () const
 
virtual std::string toString (bool verbose=false) const
 
 operator std::string () const
 
const std::shared_ptr< cugl::JsonValue > & getJSON () const
 
const Vec2getPosition () const
 
void setPosition (const Vec2 &position)
 
void setPosition (float x, float y)
 
float getPositionX (void) const
 
void setPositionX (float x)
 
float getPositionY (void) const
 
void setPositionY (float y)
 
Vec2 getWorldPosition () const
 
const SizegetContentSize () const
 
virtual void setContentSize (const Size &size)
 
virtual void setContentSize (float width, float height)
 
float getContentWidth () const
 
void setContentWidth (float width)
 
float getContentHeight () const
 
void setContentHeight (float height)
 
virtual Rect getLayoutBounds () const
 
Size getSize () const
 
float getWidth () const
 
float getHeight () const
 
Rect getBoundingBox () const
 
virtual bool inContentBounds (const Vec2 &point)
 
bool inContentBounds (float x, float y)
 
virtual void setAnchor (const Vec2 &anchor)
 
virtual void setAnchor (float x, float y)
 
const Vec2getAnchor () const
 
Vec2 getAnchorInPixels ()
 
Color4 getColor () const
 
virtual void setColor (Color4 color)
 
Color4 getAbsoluteColor ()
 
bool isVisible () const
 
void setVisible (bool visible)
 
bool hasRelativeColor () const
 
void setRelativeColor (bool flag)
 
std::shared_ptr< graphics::ScissorgetScissor () const
 
void setScissor (const std::shared_ptr< graphics::Scissor > &scissor)
 
void setScissor ()
 
const Vec2getScale () const
 
float getScaleX () const
 
float getScaleY () const
 
void setScale (float scale)
 
void setScale (const Vec2 &vec)
 
void setScale (float sx, float sy)
 
float getAngle ()
 
void setAngle (float angle)
 
const Affine2getTransform () const
 
const Affine2getAlternateTransform () const
 
void setAlternateTransform (const Affine2 &transform)
 
bool withAlternateTransform ()
 
void chooseAlternateTransform (bool active)
 
const Affine2getNodeToParentTransform () const
 
Affine2 getParentToNodeTransform () const
 
virtual Affine2 getNodeToWorldTransform () const
 
Affine2 getWorldToNodeTransform () const
 
Vec2 screenToNodeCoords (const Vec2 &screenPoint) const
 
Vec2 worldToNodeCoords (const Vec2 &worldPoint) const
 
Vec2 nodeToScreenCoords (const Vec2 &nodePoint) const
 
Vec2 nodeToWorldCoords (const Vec2 &nodePoint) const
 
Vec2 parentToNodeCoords (const Vec2 &parentPoint) const
 
Vec2 nodeToParentCoords (const Vec2 &nodePoint) const
 
size_t getChildCount () const
 
std::shared_ptr< SceneNodegetChild (unsigned int pos)
 
const std::shared_ptr< SceneNode > & getChild (unsigned int pos) const
 
template<typename T >
std::shared_ptr< TgetChild (unsigned int pos) const
 
std::shared_ptr< SceneNodegetChildByTag (unsigned int tag) const
 
template<typename T >
std::shared_ptr< TgetChildByTag (unsigned int tag) const
 
std::shared_ptr< SceneNodegetChildByName (const std::string name) const
 
template<typename T >
std::shared_ptr< TgetChildByName (const std::string name) const
 
std::vector< std::shared_ptr< SceneNode > > getChildren ()
 
const std::vector< std::shared_ptr< SceneNode > > & getChildren () const
 
void addChild (const std::shared_ptr< SceneNode > &child)
 
void addChildWithTag (const std::shared_ptr< SceneNode > &child, unsigned int tag)
 
void addChildWithName (const std::shared_ptr< SceneNode > &child, const std::string name)
 
void swapChild (const std::shared_ptr< SceneNode > &child1, const std::shared_ptr< SceneNode > &child2, bool inherit=false)
 
SceneNodegetParent ()
 
const SceneNodegetParent () const
 
Scene2getScene ()
 
const Scene2getScene () const
 
void removeFromParent ()
 
virtual void removeChild (unsigned int pos)
 
void removeChild (const std::shared_ptr< SceneNode > &child)
 
void removeChildByTag (unsigned int tag)
 
void removeChildByName (const std::string name)
 
virtual void removeAllChildren ()
 
void setPriority (float priority)
 
float getPriority ()
 
virtual void render (const std::shared_ptr< graphics::SpriteBatch > &batch, const Affine2 &transform, Color4 tint)
 
virtual void render (const std::shared_ptr< graphics::SpriteBatch > &batch)
 
virtual void draw (const std::shared_ptr< graphics::SpriteBatch > &batch, const Affine2 &transform, Color4 tint)
 
Constraint getLayoutConstraint () const
 
void setLayoutConstraint (Constraint constraint)
 
const std::shared_ptr< Layout > & getLayout () const
 
void setLayout (const std::shared_ptr< Layout > &layout)
 
virtual void doLayout ()
 

Static Public Member Functions

static std::shared_ptr< ProgressBarallocWithSize (const Size &size)
 
static std::shared_ptr< ProgressBarallocWithTexture (const std::shared_ptr< graphics::Texture > &texture)
 
static std::shared_ptr< ProgressBarallocWithTexture (const std::shared_ptr< graphics::Texture > &texture, const Size &size)
 
static std::shared_ptr< ProgressBarallocWithCaps (const std::shared_ptr< graphics::Texture > &texture, float left, float right)
 
static std::shared_ptr< ProgressBarallocWithCaps (const std::shared_ptr< graphics::Texture > &texture, float left, float right, const Size &size)
 
static std::shared_ptr< SceneNodeallocWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data)
 
- Static Public Member Functions inherited from cugl::scene2::SceneNode
static std::shared_ptr< SceneNodealloc ()
 
static std::shared_ptr< SceneNodeallocWithPosition (const Vec2 &pos)
 
static std::shared_ptr< SceneNodeallocWithPosition (float x, float y)
 
static std::shared_ptr< SceneNodeallocWithBounds (const Size &size)
 
static std::shared_ptr< SceneNodeallocWithBounds (float width, float height)
 
static std::shared_ptr< SceneNodeallocWithBounds (const Rect &rect)
 
static std::shared_ptr< SceneNodeallocWithBounds (float x, float y, float width, float height)
 
static std::shared_ptr< SceneNodeallocWithData (const AssetManager *manager, const std::shared_ptr< JsonValue > &data)
 
static std::shared_ptr< SceneNodeallocForDrawableBounds ()
 
static std::shared_ptr< SceneNodeallocForSafeBounds ()
 

Protected Member Functions

virtual void generateRenderData ()
 
void clearRenderData ()
 

Protected Attributes

float _progress
 
std::shared_ptr< graphics::Texture_texture
 
bool _rendered
 
std::pair< float, float > _interior
 
graphics::Mesh< graphics::SpriteVertex_mesh
 
graphics::BlendState _blend
 

Additional Inherited Members

- Public Types inherited from cugl::scene2::SceneNode
enum class  Constraint : int { NONE = 0 , SCENE = 1 , SAFE = 2 , LAYOUT = 3 }
 
- Public Attributes inherited from cugl::scene2::SceneNode
Vec2 _position
 
Vec2 _anchor
 
Size _contentSize
 
Color4 _tintColor
 
bool _hasParentColor
 
bool _isVisible
 
std::shared_ptr< graphics::Scissor_scissor
 
Vec2 _scale
 
float _angle
 
Affine2 _transform
 
bool _useTransform
 
Affine2 _combined
 
std::vector< std::shared_ptr< SceneNode > > _children
 
SceneNode_parent
 
Scene2_graph
 
std::shared_ptr< Layout_layout
 
Constraint _constraint
 
int _childOffset
 
unsigned int _tag
 
std::string _name
 
size_t _hashOfName
 
std::string _classname
 
float _priority
 
std::shared_ptr< JsonValue_json
 

Detailed Description

This class is a node the represents an (animating) project bar.

The progress bar may either be represented via a texture or a simple colored rectangle. If it is a texture, it acts as a 3-patch (a nine patch with no top or bottom component). It will draw the left and right side of the 3-patch and scale the middle component to match the progress. So if the progress value is at 50%, the middle portion will be at half its maximum size.

Constructor & Destructor Documentation

◆ ProgressBar()

cugl::scene2::ProgressBar::ProgressBar ( )

Creates an uninitialized progress bar with no size or texture information.

You must initialize this progress bar before use.

NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate a Node on the heap, use one of the static constructors instead.

◆ ~ProgressBar()

cugl::scene2::ProgressBar::~ProgressBar ( )
inline

Deletes this progress bar, disposing all resources

Member Function Documentation

◆ allocWithCaps() [1/2]

static std::shared_ptr< ProgressBar > cugl::scene2::ProgressBar::allocWithCaps ( const std::shared_ptr< graphics::Texture > &  texture,
float  left,
float  right 
)
inlinestatic

Returns a newly allocated progress bar with the texture and endcaps.

The progress bar will be the size of the texture. The values left and right refer to pixels in the texture. They represent the end of the left endcap and the start of the right endcap, respectively.

The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
leftThe end of the left endcap in pixels
rightThe start of the right endcap in pixels
Returns
a newly allocated progress bar with the texture and endcaps.

◆ allocWithCaps() [2/2]

static std::shared_ptr< ProgressBar > cugl::scene2::ProgressBar::allocWithCaps ( const std::shared_ptr< graphics::Texture > &  texture,
float  left,
float  right,
const Size size 
)
inlinestatic

Returns a newly allocated progress bar with the given texture and size.

The progress bar will have the given size, which includes the size of the endcaps. The values left and right refer to pixels in the texture. They represent the end of the left endcap and the start of the right endcap, respectively.

The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
leftThe end of the left endcap in pixels
rightThe start of the right endcap in pixels
sizeThe progress bar size
Returns
a newly allocated progress bar with the given texture and size.

◆ allocWithData()

static std::shared_ptr< SceneNode > cugl::scene2::ProgressBar::allocWithData ( const AssetManager manager,
const std::shared_ptr< JsonValue > &  data 
)
inlinestatic

Returns a newly allocated node with the given JSON specificaton.

This initializer is designed to receive the "data" object from the JSON passed to Scene2Loader. This JSON format supports all of the attribute values of its parent class. In addition, it supports the following additional attributes:

 "texture":  The name of a previously loaded texture asset
 "interior": An two-element array of numbers (left,right)
 "blend":    A string matching a blend mode.

All attributes are optional. There are no required attributes.

Parameters
managerThe asset manager handling this asset
dataThe JSON object specifying the node
Returns
a newly allocated node with the given JSON specificaton.

◆ allocWithSize()

static std::shared_ptr< ProgressBar > cugl::scene2::ProgressBar::allocWithSize ( const Size size)
inlinestatic

Returns a newly allocated texture-less progress bar of the given size.

The progress bar will be a rectangle with getColor as its fill color. The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
sizeThe progress bar size
Returns
a newly allocated texture-less progress bar of the given size.

◆ allocWithTexture() [1/2]

static std::shared_ptr< ProgressBar > cugl::scene2::ProgressBar::allocWithTexture ( const std::shared_ptr< graphics::Texture > &  texture)
inlinestatic

Returns a newly allocated progress bar with the given texture.

The progress bar will be the size of the texture. It will not have any endcaps and will stretch the texture to the size of the bar. The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
Returns
a newly allocated progress bar with the given texture.

◆ allocWithTexture() [2/2]

static std::shared_ptr< ProgressBar > cugl::scene2::ProgressBar::allocWithTexture ( const std::shared_ptr< graphics::Texture > &  texture,
const Size size 
)
inlinestatic

Returns a newly allocated progress bar with the given texture and size

The progress bar texture will scale to the given size. It will not have any endcaps and will stretch the texture to the size of the bar. The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
sizeThe progress bar size
Returns
a newly allocated progress bar with the given texture and size

◆ clearRenderData()

void cugl::scene2::ProgressBar::clearRenderData ( )
protected

Clears the render data, releasing all vertices and indices.

◆ dispose()

virtual void cugl::scene2::ProgressBar::dispose ( )
overridevirtual

Disposes all of the resources used by this node.

A disposed progress bar can be safely reinitialized. Any children owned by this node will be released. They will be deleted if no other object owns them.

It is unsafe to call this on a progress bar that is still currently inside of a scene graph.

Reimplemented from cugl::scene2::SceneNode.

◆ draw()

virtual void cugl::scene2::ProgressBar::draw ( const std::shared_ptr< graphics::SpriteBatch > &  batch,
const Affine2 transform,
Color4  tint 
)
overridevirtual

Draws this Node via the given SpriteBatch.

This method provides the code for drawing a progress bar designed to fill the current node content size. This method only worries about drawing the current node. It does not attempt to render the children. Note that this method is guaranteed to only be called when the node is visible.

Parameters
batchThe SpriteBatch to draw with.
transformThe global transformation matrix.
tintThe tint to blend with the Node color.

Reimplemented from cugl::scene2::SceneNode.

◆ generateRenderData()

virtual void cugl::scene2::ProgressBar::generateRenderData ( )
protectedvirtual

Allocate the render data necessary to render this node.

◆ getBlendState()

const graphics::BlendState & cugl::scene2::ProgressBar::getBlendState ( ) const
inline

Returns the color blend state for this NinePatch.

Note that if color blending was set using setBlendMode, that blend mode was expanded into a blend state, and this value will be the result of this expansion. By default this value is equivalent to graphics::BlendMode#PREMULT, as image files are loaded with premultiplied alpha.

This blend state only affects the texture of the current node. It does not affect any children of the node.

Returns
the color blend state for this NinePatch.

◆ getInterior()

const std::pair< float, float > cugl::scene2::ProgressBar::getInterior ( ) const
inline

Returns the interior internal defining progress bar.

The interior interval is specified in pixel coordinates. It is with respect to x-coordinates, which have their origin on the left.

The interior interval is similar to a NinePatch. It the interval is (3,6) then the left endcap ends at x=3 and the right endcap starts at x=6. This value is ignored if there is no texture.

Returns
the interior internal defining progress bar.

◆ getProgress()

float cugl::scene2::ProgressBar::getProgress ( ) const
inline

Returns the percentage progress of this progress bar

This value is a float between 0 and 1. Changing this value will alter the size of the progress bar foreground.

Returns
the percentage progress of this progress bar

◆ getTexture() [1/2]

std::shared_ptr< graphics::Texture > cugl::scene2::ProgressBar::getTexture ( )
inline

Returns the texture used by this node.

This value can be nullptr. In that case the progress bar is a solid rectangle with no endcaps.

Returns
the texture used by this node

◆ getTexture() [2/2]

const std::shared_ptr< graphics::Texture > & cugl::scene2::ProgressBar::getTexture ( ) const
inline

Returns the texture used by this node.

This value can be nullptr. In that case the progress bar is a solid rectangle with no endcaps.

Returns
the texture used by this node

◆ init()

virtual bool cugl::scene2::ProgressBar::init ( )
inlineoverridevirtual

Deactivates the default initializer.

This initializer may not be used for a progress bar. A progress bar either needs a texture or a size

Returns
false

Reimplemented from cugl::scene2::SceneNode.

◆ initWithCaps() [1/2]

bool cugl::scene2::ProgressBar::initWithCaps ( const std::shared_ptr< graphics::Texture > &  texture,
float  left,
float  right 
)

Initializes a progress bar with the texture and endcaps.

The progress bar will be the size of the texture. The values left and right refer to pixels in the texture. They represent the end of the left endcap and the start of the right endcap, respectively.

The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
leftThe end of the left endcap in pixels
rightThe start of the right endcap in pixels
Returns
true if the progress bar is initialized properly, false otherwise.

◆ initWithCaps() [2/2]

bool cugl::scene2::ProgressBar::initWithCaps ( const std::shared_ptr< graphics::Texture > &  texture,
float  left,
float  right,
const Size size 
)

Initializes a progress bar with the given texture and size.

The progress bar will have the given size, which includes the size of the endcaps. The values left and right refer to pixels in the texture. They represent the end of the left endcap and the start of the right endcap, respectively.

The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
leftThe end of the left endcap in pixels
rightThe start of the right endcap in pixels
sizeThe progress bar size
Returns
true if the progress bar is initialized properly, false otherwise.

◆ initWithData()

bool cugl::scene2::ProgressBar::initWithData ( const AssetManager manager,
const std::shared_ptr< JsonValue > &  data 
)
overridevirtual

Initializes a node with the given JSON specificaton.

This initializer is designed to receive the "data" object from the JSON passed to Scene2Loader. This JSON format supports all of the attribute values of its parent class. In addition, it supports the following additional attributes:

 "texture":  The name of a previously loaded texture asset
 "interior": An two-element array of numbers (left,right)
 "blend":    A string matching a blend mode.

All attributes are optional. There are no required attributes.

Parameters
managerThe asset manager handling this asset
dataThe JSON object specifying the node
Returns
true if initialization was successful.

Reimplemented from cugl::scene2::SceneNode.

◆ initWithSize()

bool cugl::scene2::ProgressBar::initWithSize ( const Size size)
inline

Initializes a texture-less progress bar of the given size.

The progress bar will be a rectangle with getColor as its fill color. The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
sizeThe progress bar size
Returns
true if the progress bar is initialized properly, false otherwise.

◆ initWithTexture() [1/2]

bool cugl::scene2::ProgressBar::initWithTexture ( const std::shared_ptr< graphics::Texture > &  texture)
inline

Initializes a progress bar with the given texture.

The progress bar will be the size of the texture. It will not have any endcaps and will stretch the texture to the size of the bar. The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
Returns
true if the progress bar is initialized properly, false otherwise.

◆ initWithTexture() [2/2]

bool cugl::scene2::ProgressBar::initWithTexture ( const std::shared_ptr< graphics::Texture > &  texture,
const Size size 
)
inline

Initializes a progress bar with the given texture and size

The progress bar texture will scale to the given size. It will not have any endcaps and will stretch the texture to the size of the bar. The progress bar will be placed at the origin of the parent and anchored at the bottom left.

Parameters
textureThe progress bar texture
sizeThe progress bar size
Returns
true if the progress bar is initialized properly, false otherwise.

◆ refresh()

void cugl::scene2::ProgressBar::refresh ( )
inline

Refreshes this node to restore the render data.

◆ setBlendMode()

void cugl::scene2::ProgressBar::setBlendMode ( const graphics::BlendMode mode)
inline

Sets the color blend mode for this NinePatch.

By default this value is graphics::BlendMode#PREMULT, as image files are loaded with premultiplied alpha. You cannot determine the blend mode for a node after it is set. You can only get the blend state for that mode with the method getBlendState.

This blend state only affects the texture of the current node. It does not affect any children of the node.

Parameters
modeThe color blend mode for this NinePatch.

◆ setBlendState()

void cugl::scene2::ProgressBar::setBlendState ( const graphics::BlendState blend)
inline

Sets the color blend state for this NinePatch.

This provides much more fine-tuned control over color blending that setBlendMode. By default this value is equivalent to graphics::BlendMode#PREMULT, as image files are loaded with premultiplied alpha.

This blend state only affects the texture of the current node. It does not affect any children of the node.

Parameters
blendThe color blend state for this NinePatch.

◆ setContentSize()

virtual void cugl::scene2::ProgressBar::setContentSize ( const Size size)
overridevirtual

Sets the untransformed size of the node.

The content size remains the same no matter how the node is scaled or rotated. All nodes must have a size, though it may be degenerate (0,0).

Changing the size of a rectangle will not change the position of the node. However, if the anchor is not the bottom-left corner, it will change the origin. The Node will grow out from an anchor on an edge, and equidistant from an anchor in the center.

Parameters
sizeThe untransformed size of the node.

Reimplemented from cugl::scene2::SceneNode.

◆ setInterior() [1/2]

void cugl::scene2::ProgressBar::setInterior ( const std::pair< float, float >  interval)
inline

Sets the interior internal defining the progress bar.

The interior interval is specified in pixel coordinates. It is with respect to x-coordinates, which have their origin on the left.

The interior interval is similar to a NinePatch. It the interval is (3,6) then the left endcap ends at x=3 and the right endcap starts at x=6. This value is ignored if there is no texture.

Parameters
intervalThe interior interval

◆ setInterior() [2/2]

void cugl::scene2::ProgressBar::setInterior ( float  left,
float  right 
)

Sets the interior internal defining the progress bar.

The interior interval is specified in pixel coordinates. It is with respect to x-coordinates, which have their origin on the left.

The interior interval is similar to a NinePatch. It the interval is (3,6) then the left endcap ends at x=3 and the right endcap starts at x=6. This value is ignored if there is no texture.

Parameters
leftThe left side of the interior
rightThe right side of the interior

◆ setProgress()

void cugl::scene2::ProgressBar::setProgress ( float  progress)

Sets the percentage progress of this progress bar

This value is a float between 0 and 1. Changing this value will alter the size of the progress bar foreground.

Parameters
progressThe percentage progress of this progress bar

◆ setTexture() [1/2]

void cugl::scene2::ProgressBar::setTexture ( const std::shared_ptr< graphics::Texture > &  texture)

Sets the node texture to the one specified.

This method will have no effect on the polygon vertices. This class decouples the geometry from the texture. That is because we do not expect the vertices to match the texture perfectly.

Parameters
textureA shared pointer to a Texture object.

◆ setTexture() [2/2]

void cugl::scene2::ProgressBar::setTexture ( const std::string &  filename)
inline

Sets the node texture to a new one allocated from a filename.

This method will have no effect on the polygon vertices. This class decouples the geometry from the texture. That is because we do not expect the vertices to match the texture perfectly.

Parameters
filenameA path to image file, e.g., "scene1/earthtile.png"

◆ toString()

virtual std::string cugl::scene2::ProgressBar::toString ( bool  verbose = false) const
overridevirtual

Returns a string representation of this node for debugging purposes.

If verbose is true, the string will include class information. This allows us to unambiguously identify the class.

Parameters
verboseWhether to include class information
Returns
a string representation of this node for debuggging purposes.

Reimplemented from cugl::scene2::SceneNode.

Member Data Documentation

◆ _blend

graphics::BlendState cugl::scene2::ProgressBar::_blend
protected

The blending equation for the texture

◆ _interior

std::pair<float,float> cugl::scene2::ProgressBar::_interior
protected

The interior interval

◆ _mesh

graphics::Mesh<graphics::SpriteVertex> cugl::scene2::ProgressBar::_mesh
protected

The render vertices for this node

◆ _progress

float cugl::scene2::ProgressBar::_progress
protected

The progress percentage of this progress bar (between 0 and 1)

◆ _rendered

bool cugl::scene2::ProgressBar::_rendered
protected

Whether we have generated render data for this node

◆ _texture

std::shared_ptr<graphics::Texture> cugl::scene2::ProgressBar::_texture
protected

The texture for the progress bar (if it exists)


The documentation for this class was generated from the following file: