{"id":18271314,"url":"https://github.com/asinesio/cocos2d-PRKit","last_synced_at":"2025-04-05T01:31:21.810Z","repository":{"id":140483903,"uuid":"1570478","full_name":"asinesio/cocos2d-PRKit","owner":"asinesio","description":"Additions to the fabulous cocos2d-iphone library as provided by Precognitive Research.","archived":false,"fork":false,"pushed_at":"2013-02-26T02:52:09.000Z","size":3126,"stargazers_count":128,"open_issues_count":0,"forks_count":31,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-11-05T11:53:52.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://precognitiveresearch.com","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asinesio.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-04-05T03:31:12.000Z","updated_at":"2022-02-02T08:08:15.000Z","dependencies_parsed_at":"2023-03-13T10:42:02.655Z","dependency_job_id":null,"html_url":"https://github.com/asinesio/cocos2d-PRKit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asinesio%2Fcocos2d-PRKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asinesio%2Fcocos2d-PRKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asinesio%2Fcocos2d-PRKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asinesio%2Fcocos2d-PRKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asinesio","download_url":"https://codeload.github.com/asinesio/cocos2d-PRKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276043,"owners_count":20912286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T11:39:13.214Z","updated_at":"2025-04-05T01:31:16.796Z","avatar_url":"https://github.com/asinesio.png","language":"Objective-C","funding_links":[],"categories":["etc"],"sub_categories":[],"readme":"PRKit\n=====\n\nPRKit is a library of some small additions to the fantastic \u003ca href=\"http://cocos2d-iphone.org\"\u003ecocos2d for iphone\u003c/a\u003e project that some people on the cocos2d forums found useful and figured others might like as well.\n\nPRKit was contributed to the open source community by \u003ca href=\"http://precognitiveresearch.com\"\u003ePrecognitive Research, LLC\u003c/a\u003e.\n\nLicense\n----------\nThis is licensed using the same license as cocos2d itself and provided with absolutely no warranty.  You are free to use the PRKit code as you wish as long as you keep the license in the source code.\n\nThis code uses the excellent \u003ca href=\"http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml\"\u003eTriangulate C++ classes\u003c/a\u003e written by \u003ca href=\"mailto:jratcliff@verant.com\"\u003eJohn W. Ratcliff\u003c/a\u003e.\n\nRelease Notes\n-------------\n\n##### Version 0.3 (2013-02-24)\n* Fixed issue with Mac OS X and 64 bit (#9)\n* Restructured project into more sensible structure.\n\n##### Version 0.2 (2013-02-13)\n* Support for cocos2d 2.0 (thanks to [Panajev's](http://github.com/panajev) pull request)\n\n##### Version 0.1 (2012-02-24)\n* Initial release for cocos2d 1.1.\n\nInstallation\n------------\nDownload the source and add the files under ''PRKit'' to your project:\n* PRFilledPolygon.h\n* PRFilledPolygon.m\n* PRTriangulator.h\n* PRRatcliffTriangulator.h\n* PRRatcliffTriangulator.mm\n* triangulate.h\n* triangulate.cpp \n\nCompatibility\n-------------\nTested with cocos2d 2.0 for iOS and Mac OS X.\n\nOther Documentation\n-------------------\nAllen Tan wrote a great [tutorial on making a game with PRKit](http://www.raywenderlich.com/14302/how-to-make-a-game-like-fruit-ninja-with-box2d-and-cocos2d-part-1).  \n\nNote that the changes to PRKit described in the tutorial are not needed, since they've been merged into the code. \n\n\nClass Overview\n--------------\n### PRFilledPolygon\n\nPRFilledPolygon will fill a polygon of arbitrary points with a texture; think of it like using the Polygon tool in Photoshop and then filling it in using the paint bucket tool.\n\nThe class inherits from CCNode, so it can be added to your hierarchy as any other class and should respond to position changes like any other node. (Please test and let us know!)\n\n    NSMutableArray *polygonPoints = [NSMutableArray arrayWithCapacity:10];\n    [polygonPoints addObject:[NSValue valueWithCGPoint:ccp(100,100)]];\n    [polygonPoints addObject:[NSValue valueWithCGPoint:ccp(200,100)]];\n    [polygonPoints addObject:[NSValue valueWithCGPoint:ccp(300,200)]];\n    [polygonPoints addObject:[NSValue valueWithCGPoint:ccp(400,300)]];\n    [polygonPoints addObject:[NSValue valueWithCGPoint:ccp(500,500)]]; \n    \n    CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage:@\"pattern1.png\"];\n    PRFilledPolygon *filledPolygon = [[[PRFilledPolygon alloc] initWithPoints:polygonPoints andTexture:texture] autorelease];\n    [self addChild:filledPolygon z:0];\n\nYou can also change the points on the fly by calling setPoints:\n\n    float newY = 75.0f * CCRANDOM_0_1();       \n    NSArray *points = [NSArray arrayWithObjects:[NSValue valueWithCGPoint:ccp(0,0)], \n        [NSValue valueWithCGPoint:ccp(0,75)],\n        [NSValue valueWithCGPoint:ccp(75,newY + 75)],\n        [NSValue valueWithCGPoint:ccp(75,0)],\n        nil];\n    id box = [self getChildByTag:kTagBox];\n    [box setPoints:points];\n\nThe class also supports pluggable \u003ci\u003ePRTriangulator\u003c/i\u003e implementations. Just set the triangulator object with something that implements the \u003ci\u003ePRTriangulator\u003c/i\u003e protocol.\n\n### PRTriangulator\n\nThis is a protocol for pluggable triangulators.  The Ratcliff implementation is the only one that ships with PRKit right now, but should you want to write your own, go right ahead -- you only have to implement one method:\n\n    - (NSArray *) triangulateVertices:(NSArray *)vertices;\n\nThere is a \u003ca href=\"http://www.vterrain.org/Implementation/Libs/triangulate.html\"\u003egreat reference on vterrian.org\u003c/a\u003e with links to many different triangulation algorithms.\n\n### PRRatcliffTriangulator\n\nThis implements the \u003ci\u003ePRTriangulator\u003c/i\u003e and is the default triangulator supplied for PRKit.  It uses Ratcliff's triangulator from flipcode (shipped with the code as \u003ci\u003etriangulator.h\u003c/i\u003e and \u003ci\u003etriangulator.cpp\u003c/i\u003e).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasinesio%2Fcocos2d-PRKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasinesio%2Fcocos2d-PRKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasinesio%2Fcocos2d-PRKit/lists"}