Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GloryFish/Cocos2D-Touchable-Nodes
Provides lightweight CCNodes which can respond to touches within a given rectangle.
https://github.com/GloryFish/Cocos2D-Touchable-Nodes
Last synced: 3 months ago
JSON representation
Provides lightweight CCNodes which can respond to touches within a given rectangle.
- Host: GitHub
- URL: https://github.com/GloryFish/Cocos2D-Touchable-Nodes
- Owner: GloryFish
- Created: 2010-02-25T16:03:21.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2010-03-18T16:54:53.000Z (almost 15 years ago)
- Last Synced: 2023-03-10T23:37:34.173Z (almost 2 years ago)
- Language: Objective-C
- Homepage: http://gloryfish.org
- Size: 216 KB
- Stars: 14
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
- awesome - Cocos2D-Touchable-Nodes - Provides lightweight CCNodes which can respond to touches within a given rectangle. (etc)
- awesome - Cocos2D-Touchable-Nodes - Provides lightweight CCNodes which can respond to touches within a given rectangle. (etc)
README
README
TouchableNodes
Created by Jay Roberts on 2010-02-25.
Copyright 2010 GloryFish.org. All rights reserved.
License: http://www.cocos2d-iphone.org/wiki/doku.php/license (GNU LGPL v3 with an extension)Lightweight classes providing invisible and semi-invisible UI elements for responding to touches. Supports canceling a button press by dragging off of the button.
Created for use in TCG Counter http://tcgcounter.com where most of the UI is provided by a single static background image and touches are indicated with particle system emits. TouchableRegions are used to define static button locations on the screen and are wired into methods on the parent view.
TouchableOverlays are also used for simple static buttons that are part of the background but also have a hover state. An additional CCSprite is provides which is displayed when touched and faded out when cancelled.
Usage:
// Layer init
-(id)init {
TouchableRegion *button = [TouchableRegion regionWithRect: CGRectMake(0.0f, 100.0f, 100.0f, 100.0f) target: self selector:@selector(buttonPress)];
button.showOutline = YES; // Optionally draw an outline for testing
[self addChild: button z: 1];}
// Layer method
-(void) buttonPress {
NSLog(@"Button Pressed!");
}