summary refs log tree commit diff stats
path: root/libs/cocos2d/CCProgressTimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/cocos2d/CCProgressTimer.h')
-rwxr-xr-xlibs/cocos2d/CCProgressTimer.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/libs/cocos2d/CCProgressTimer.h b/libs/cocos2d/CCProgressTimer.h new file mode 100755 index 0000000..9a07f2f --- /dev/null +++ b/libs/cocos2d/CCProgressTimer.h
@@ -0,0 +1,83 @@
1/*
2 * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 *
4 * Copyright (c) 2010 Lam Pham
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 *
24 */
25
26#import <Foundation/Foundation.h>
27#import "CCSprite.h"
28
29/** Types of progress
30 @since v0.99.1
31 */
32typedef enum {
33 /// Radial Counter-Clockwise
34 kCCProgressTimerTypeRadialCCW,
35 /// Radial ClockWise
36 kCCProgressTimerTypeRadialCW,
37 /// Horizontal Left-Right
38 kCCProgressTimerTypeHorizontalBarLR,
39 /// Horizontal Right-Left
40 kCCProgressTimerTypeHorizontalBarRL,
41 /// Vertical Bottom-top
42 kCCProgressTimerTypeVerticalBarBT,
43 /// Vertical Top-Bottom
44 kCCProgressTimerTypeVerticalBarTB,
45} CCProgressTimerType;
46
47/**
48 CCProgresstimer is a subclass of CCNode.
49 It renders the inner sprite according to the percentage.
50 The progress can be Radial, Horizontal or vertical.
51 @since v0.99.1
52 */
53@interface CCProgressTimer : CCNode
54{
55 CCProgressTimerType type_;
56 float percentage_;
57 CCSprite *sprite_;
58
59 int vertexDataCount_;
60 ccV2F_C4B_T2F *vertexData_;
61}
62
63/** Change the percentage to change progress. */
64@property (nonatomic, readwrite) CCProgressTimerType type;
65
66/** Percentages are from 0 to 100 */
67@property (nonatomic, readwrite) float percentage;
68
69/** The image to show the progress percentage */
70@property (nonatomic, readwrite, retain) CCSprite *sprite;
71
72
73/** Creates a progress timer with an image filename as the shape the timer goes through */
74+ (id) progressWithFile:(NSString*) filename;
75/** Initializes a progress timer with an image filename as the shape the timer goes through */
76- (id) initWithFile:(NSString*) filename;
77
78/** Creates a progress timer with the texture as the shape the timer goes through */
79+ (id) progressWithTexture:(CCTexture2D*) texture;
80/** Creates a progress timer with the texture as the shape the timer goes through */
81- (id) initWithTexture:(CCTexture2D*) texture;
82
83@end