{"id":18271466,"url":"https://github.com/givp/Cocos2d-Menu-Scroller","last_synced_at":"2025-04-05T01:31:35.461Z","repository":{"id":1269249,"uuid":"1208362","full_name":"givp/Cocos2d-Menu-Scroller","owner":"givp","description":"A CCLayer subclass for creating scrollable pages in Cocos2d (iOS). Can be used for scrollable menus in games. NOTE: CCScrollLayer is now a part of cocos2d-iphone-extensions repo: https://github.com/cocos2d/cocos2d-iphone-extensions/","archived":false,"fork":false,"pushed_at":"2011-07-15T22:37:23.000Z","size":139,"stargazers_count":44,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-05T11:53:54.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.givp.org/blog/2010/12/30/scrolling-menus-in-cocos2d/","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/givp.png","metadata":{"files":{"readme":"README","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":"2010-12-30T12:46:31.000Z","updated_at":"2022-01-18T01:55:14.000Z","dependencies_parsed_at":"2022-08-16T12:50:34.137Z","dependency_job_id":null,"html_url":"https://github.com/givp/Cocos2d-Menu-Scroller","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givp%2FCocos2d-Menu-Scroller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givp%2FCocos2d-Menu-Scroller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givp%2FCocos2d-Menu-Scroller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givp%2FCocos2d-Menu-Scroller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/givp","download_url":"https://codeload.github.com/givp/Cocos2d-Menu-Scroller/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:19.253Z","updated_at":"2025-04-05T01:31:32.843Z","avatar_url":"https://github.com/givp.png","language":"Objective-C","funding_links":[],"categories":["etc"],"sub_categories":[],"readme":"===================================================\nIMPORTANT:\nPlease note CCScrollLayer is now a part of cocos2d-iphone-extensions repo:\nhttps://github.com/cocos2d/cocos2d-iphone-extensions/\n===================================================\n\n\n\n\n\n\n\n===========================\nCCScrollLayer\n===========================\nGiv Parvaneh\n@givp\nhttp://www.givp.org/blog/2010/12/30/scrolling-menus-in-cocos2d/\n\n\n\nThis class was originally written by DK101\nhttp://dk101.net/2010/11/30/implementing-page-scrolling-in-cocos2d/\n\nIt is a very clean and elegant subclass of CCLayer that lets you pass-in an array of layers and it will then create a smooth scroller. Complete with the \"snapping\" effect. You can create screens with anything that can be added to a CCLayer.\n\nIt is mostly the same with the following changes:\n\n- updated to work with Cocos2d 0.99.5\n- added the option to change the width of each layer for the \"Angry Birds\" style preview effect\n- removed CCTouchDispatcher on exit (this was messing up touch events on other scenes)\n\nUSAGE:\n\n1. add both files to your project\n2. in your scene import CCScrollLayer.h\n3. in your scene's init method construct each layer and pass it to the CCScrollLayer class:\n\ne.g.\n\n// get screen size\nCGSize screenSize = [CCDirector sharedDirector].winSize;\n\n/////////////////////////////////////////////////\n// PAGE 1\n////////////////////////////////////////////////\n// create a blank layer for page 1\nCCLayer *pageOne = [[CCLayer alloc] init];\n\n// create a label for page 1\nCCLabelTTF *label = [CCLabelTTF labelWithString:@\"Page 1\" fontName:@\"Arial Rounded MT Bold\" fontSize:44];\nlabel.position =  ccp( screenSize.width /2 , screenSize.height/2 );\n\n// add label to page 1 layer\n[pageOne addChild:label];\n\n/////////////////////////////////////////////////\n// PAGE 2\n////////////////////////////////////////////////\n// create a blank layer for page 2\nCCLayer *pageTwo = [[CCLayer alloc] init];\n\n// create a custom font menu for page 2\nCCLabelBMFont *tlabel = [CCLabelBMFont labelWithString:@\"Page 2\" fntFile:@\"customfont.fnt\"];\nCCMenuItemLabel *titem = [CCMenuItemLabel itemWithLabel:tlabel target:self selector:@selector(testCallback:)];\nCCMenu *menu = [CCMenu menuWithItems: titem, nil];\nmenu.position = ccp(screenSize.width/2, screenSize.height/2);\n\n// add menu to page 2\n[pageTwo addChild:menu];\n////////////////////////////////////////////////\n\n// now create the scroller and pass-in the pages (set widthOffset to 0 for fullscreen pages)\nCCScrollLayer *scroller = [[CCScrollLayer alloc] initWithLayers:[NSMutableArray arrayWithObjects: pageOne,pageTwo,pageThree,nil] widthOffset: 230];\n\n// finally add the scroller to your scene\n[self addChild:scroller];\n\n\nEnjoy :)\nG\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgivp%2FCocos2d-Menu-Scroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgivp%2FCocos2d-Menu-Scroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgivp%2FCocos2d-Menu-Scroller/lists"}