This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
users:shilo:extensions:shpolygon [2012/08/21 00:34] – [SHPolygon] 67.181.243.216 | users:shilo:extensions:shpolygon [2013/08/30 15:50] (current) – shilo | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SHPolygon (OLD VERSION) ====== | ||
+ | ---- dataentry extension ---- | ||
+ | type : extension | ||
+ | author_mail | ||
+ | description | ||
+ | lastupdate_dt : 2011-03-19 | ||
+ | compatible | ||
+ | depends | ||
+ | tags : polygon, shape, primitive | ||
+ | homepage_url | ||
+ | download_url | ||
+ | sample_url | ||
+ | ---- | ||
+ | ===== Description ===== | ||
+ | SHPolygon class will allow you to create primitive polygon shapes on the stage. You can set the number of sides, customize inner color, outer color, border color, change the border width, toggle the fill and border, set the center x, center y, change the radius x, radius y, rotate around center, and everything else you can do with an SPDisplayObject. | ||
+ | ===== Sample ===== | ||
+ | [[http:// | ||
+ | * Project: [[http:// | ||
+ | * Screenshot: [[http:// | ||
+ | * Recording: [[http:// | ||
+ | |||
+ | ===== Example ===== | ||
+ | <code objc> | ||
+ | //add a triangle with default sides: 3 | ||
+ | SHPolygon *triangle = [SHPolygon polygonWithWidth: | ||
+ | [self addChild: | ||
+ | |||
+ | //add a diamond shape | ||
+ | SHPolygon *diamond = [SHPolygon polygonWithWidth: | ||
+ | diamond.sides = 4; | ||
+ | [self addChild: | ||
+ | |||
+ | //add a star and center it on stage | ||
+ | SHPolygon *star = [SHPolygon polygonWithWidth: | ||
+ | star.sides = 5; | ||
+ | star.innerColor = 0xffffff; | ||
+ | star.outerColor = 0x000000; | ||
+ | star.centerX = 320/2; | ||
+ | star.centerY = 480/2; | ||
+ | [self addChild: | ||
+ | |||
+ | //add a circle with default width and height: 32 | ||
+ | SHPolygon *circle = [SHPolygon polygon]; | ||
+ | circle.sides = 360; | ||
+ | [self addChild: | ||
+ | </ | ||
+ | |||
+ | ===== Instructions ===== | ||
+ | ==== To add into your Sparrow project ==== | ||
+ | - Download the source files here: [[https:// | ||
+ | - Open your desired Sparrow project | ||
+ | - Drag and drop the files into the " | ||
+ | - Open " | ||
+ | - Include the extension: <code objc># | ||
+ | - Save " | ||
+ | |||
+ | ==== To add directly into Sparrow source ==== | ||
+ | - Download the source files here: [[https:// | ||
+ | - Save the files into Sparrow' | ||
+ | * Example: "/ | ||
+ | - Navigate back one directory and open " | ||
+ | * Example: "/ | ||
+ | - Inside the " | ||
+ | * Example: " | ||
+ | - Right click the " | ||
+ | - Navigate into the "/ | ||
+ | - On the next window, leave all options as default and click " | ||
+ | - In the " | ||
+ | * Example " | ||
+ | - At the bottom of the file, add: <code objc># | ||
+ | - Save " | ||
+ | - Close " | ||
+ | |||
+ | ===== Source Code ===== | ||
+ | %gist(878014)% | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | * // | ||
+ | * // | ||
+ | |||
+ | ===== Todo ===== | ||
+ | * Add anti-aliasing | ||
+ | * Use Core Graphics instead of OpenGL ES | ||
+ | * Only capture touch inside the polygon |