Theoretical part
Progresstimer is a subclass of node. The class renders a Sprite object that displays interior based on percentages. The direction of change includes radial, horizontal, or vertical direction.
Code section
Type GetType () const
Gets the type of the progress bar.
float getpercentage () const
Gets the percentage of the progress bar, ranging from 0 to 100, that contains 0,100
Sprite * Getsprite () const
Gets the Sprite object that is used to display the scale of the progress bar, retain
void Setpercentage (float percentage)
Sets the percentage that the progress bar displays.
void Setsprite (Sprite *sprite)
Sets the Sprite object used by the progress bar.
void SetType (Type type)
Sets the type of the progress bar.
void setreverseprogress (BOOL reverse)
Reverses the direction of the progress bar.
BOOL Isreversedirection ()
Gets whether the direction is in a reversed state.
void Setreversedirection (bool value)
Reverses the direction of the progress bar.
void Setmidpoint (const VEC2 &point)
The midpoint (midpoint) indicates the starting position of the progress bar change. If the progress bar is in radial mode, the midpoint represents the center position if the progress bar is a bar pattern, the midpoint represents the direction in which the progress bar expands. The progress bar expands from the center to the sides, so: when the progress bar is expanded from left to right, the midpoint (midpoint) is set to VEC2 (0,y); When the progress bar is expanded from right to left, the midpoint (midpoint) is set to VEC2 (1,y); When the progress bar is expanded from bottom to top, the midpoint (midpoint) is set to VEC2 (x,0); When the progress bar is expanded from the top down, set the midpoint (midpoint) to VEC2 (x,1);
VEC2 Getmidpoint () const
Gets the midpoint position.
void Setbarchangerate (const VEC2 &barchangerate)
Using this method to set the bar mode progress bar non-change Direction display scale (barchangerate) is set to 0 to ensure that the progress bar non-change direction 100 is displayed. For example, if you need a progress bar from left to right, but the upper and lower directions do not require 100 display, then set Barchangerate to VEC2 (0,1) and set the midpoint (midpoint) to VEC2 (0,.5f).
VEC2 getbarchangerate () const
Returns the value of the scale of the progress bar change
Cocos Code Research (9) Progresstimer class learning Notes