Cocos Code Research (9) Progresstimer class learning Notes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.