diff options
Diffstat (limited to 'libs/cocos2d/CCDrawingPrimitives.h')
| -rwxr-xr-x | libs/cocos2d/CCDrawingPrimitives.h | 92 | 
1 files changed, 92 insertions, 0 deletions
| diff --git a/libs/cocos2d/CCDrawingPrimitives.h b/libs/cocos2d/CCDrawingPrimitives.h new file mode 100755 index 0000000..8d1dbe5 --- /dev/null +++ b/libs/cocos2d/CCDrawingPrimitives.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /* | ||
| 2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008-2010 Ricardo Quesada | ||
| 5 | * Copyright (c) 2011 Zynga Inc. | ||
| 6 | * | ||
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 8 | * of this software and associated documentation files (the "Software"), to deal | ||
| 9 | * in the Software without restriction, including without limitation the rights | ||
| 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 11 | * copies of the Software, and to permit persons to whom the Software is | ||
| 12 | * furnished to do so, subject to the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice shall be included in | ||
| 15 | * all copies or substantial portions of the Software. | ||
| 16 | * | ||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 23 | * THE SOFTWARE. | ||
| 24 | */ | ||
| 25 | |||
| 26 | |||
| 27 | #ifndef __CC_DRAWING_PRIMITIVES_H | ||
| 28 | #define __CC_DRAWING_PRIMITIVES_H | ||
| 29 | |||
| 30 | #import <Availability.h> | ||
| 31 | #import <Foundation/Foundation.h> | ||
| 32 | |||
| 33 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED | ||
| 34 | #import <CoreGraphics/CGGeometry.h> // for CGPoint | ||
| 35 | #endif | ||
| 36 | |||
| 37 | |||
| 38 | #ifdef __cplusplus | ||
| 39 | extern "C" { | ||
| 40 | #endif | ||
| 41 | |||
| 42 | /** | ||
| 43 | @file | ||
| 44 | Drawing OpenGL ES primitives. | ||
| 45 | - ccDrawPoint | ||
| 46 | - ccDrawLine | ||
| 47 | - ccDrawPoly | ||
| 48 | - ccDrawCircle | ||
| 49 | - ccDrawQuadBezier | ||
| 50 | - ccDrawCubicBezier | ||
| 51 | |||
| 52 | You can change the color, width and other property by calling the | ||
| 53 | glColor4ub(), glLineWidth(), glPointSize(). | ||
| 54 | |||
| 55 | @warning These functions draws the Line, Point, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch. | ||
| 56 | */ | ||
| 57 | |||
| 58 | |||
| 59 | /** draws a point given x and y coordinate measured in points. */ | ||
| 60 | void ccDrawPoint( CGPoint point ); | ||
| 61 | |||
| 62 | /** draws an array of points. | ||
| 63 | @since v0.7.2 | ||
| 64 | */ | ||
| 65 | void ccDrawPoints( const CGPoint *points, NSUInteger numberOfPoints ); | ||
| 66 | |||
| 67 | /** draws a line given the origin and destination point measured in points. */ | ||
| 68 | void ccDrawLine( CGPoint origin, CGPoint destination ); | ||
| 69 | |||
| 70 | /** draws a poligon given a pointer to CGPoint coordiantes and the number of vertices measured in points. | ||
| 71 | The polygon can be closed or open | ||
| 72 | */ | ||
| 73 | void ccDrawPoly( const CGPoint *vertices, NSUInteger numOfVertices, BOOL closePolygon ); | ||
| 74 | |||
| 75 | /** draws a circle given the center, radius and number of segments measured in points */ | ||
| 76 | void ccDrawCircle( CGPoint center, float radius, float angle, NSUInteger segments, BOOL drawLineToCenter); | ||
| 77 | |||
| 78 | /** draws a quad bezier path measured in points. | ||
| 79 | @since v0.8 | ||
| 80 | */ | ||
| 81 | void ccDrawQuadBezier(CGPoint origin, CGPoint control, CGPoint destination, NSUInteger segments); | ||
| 82 | |||
| 83 | /** draws a cubic bezier path measured in points. | ||
| 84 | @since v0.8 | ||
| 85 | */ | ||
| 86 | void ccDrawCubicBezier(CGPoint origin, CGPoint control1, CGPoint control2, CGPoint destination, NSUInteger segments); | ||
| 87 | |||
| 88 | #ifdef __cplusplus | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #endif // __CC_DRAWING_PRIMITIVES_H | ||
