This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
users:shilo:extensions:shcircle [2011/03/20 04:06] – [SHCircle] shilo | users:shilo:extensions:shcircle [2013/03/05 10:19] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SHCircle ====== | ||
+ | ---- dataentry extension ---- | ||
+ | type : extension | ||
+ | author_mail | ||
+ | description | ||
+ | lastupdate_dt : 2011-03-14 | ||
+ | compatible | ||
+ | depends | ||
+ | tags : circle, primitive | ||
+ | homepage_url | ||
+ | download_url | ||
+ | sample_url | ||
+ | ---- | ||
+ | ===== Description ===== | ||
+ | SHCircle class will allow you to create primitive circles on the stage. You can 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, set the degrees to render, rotate around center, and everything else you can do with an SPDisplayObject. | ||
+ | |||
+ | ===== Sample ===== | ||
+ | [[http:// | ||
+ | * Project: [[http:// | ||
+ | * Screenshot: [[http:// | ||
+ | * Recording: [[http:// | ||
+ | |||
+ | ===== Example ===== | ||
+ | <code objc> | ||
+ | // | ||
+ | SHCircle *circle = [SHCircle circleWithWidth: | ||
+ | |||
+ | //set the x radius to 25, which changes the width to 50 | ||
+ | circle.radiusX = 25.0f; | ||
+ | |||
+ | //set the y radius to 10, which changes the height to 20 | ||
+ | circle.radiusY = 10.0f; | ||
+ | |||
+ | //render half of the circle | ||
+ | circle.degrees = 180; | ||
+ | |||
+ | //rotate the circle 45 degrees around the center | ||
+ | circle.centerRotation = 45; | ||
+ | |||
+ | //change the solid color to blue | ||
+ | circle.color = 0x0000ff; | ||
+ | |||
+ | //change the inner color to red and outer color to black | ||
+ | circle.innerColor = 0xff0000; | ||
+ | circle.outerColor = 0x000000; | ||
+ | |||
+ | //toggle the border on | ||
+ | circle.border = YES; | ||
+ | |||
+ | //set the border width to 1 pixel | ||
+ | circle.borderWidth = 1.0f; | ||
+ | |||
+ | //set the border color to red | ||
+ | circle.borderColor = 0xff0000; | ||
+ | |||
+ | //toggle the fill off | ||
+ | circle.fill = NO; | ||
+ | |||
+ | //center the circle on stage | ||
+ | circle.centerX = 320/2; | ||
+ | circle.centerY = 480/2; | ||
+ | |||
+ | //add the circle to stage | ||
+ | [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(870359)% | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | * // | ||
+ | |||
+ | ===== Todo ===== | ||
+ | * Add anti-aliasing | ||
+ | * Use Core Graphics instead of OpenGL ES | ||
+ | * Only capture touch inside the circle |