Provides lightweight CCNodes which can respond to touches within a given rectangle.
Objective-C C
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1 commit ahead of GloryFish:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Created by Jay Roberts on 2010-02-25.
Copyright 2010 All rights reserved.
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 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.


// 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!");