"Cool and funky stuff"
I meant if you wanted pie charts with funny characters and particle colour fades etc, I'd use UIKit/Foundation stuff to manage and handle the data, and add the bells and whistles by using Sparrow effects.
Anyways, I think you are imaging mixing the two to be far more difficult than it really is, here is a cut down version of my main menu class:
//
// MainMenu.m
//
#import "MainMenu.h"
#import "SXParticleSystem.h"
#import other stuff whatevs
@implementation MainMenu
-(void)goToLevel:(SPEvent*)event {
// DO STUFF WITH (SPDisplayObject*)[event target]
}
-(void)selectedStuff:(id)sender {
// Do stuff with id sender
UIButton *selectedButton = (UIButton*)sender;
}
-(id)init {
if ((self = [super init])) {
// quad as background (enables full screen touches)
SPQuad *quad = [[SPQuad alloc] initWithWidth:SCENE_WIDTH height:SCENE_HEIGHT color:0xffffff];
quad.alpha = 1.0f;
[self addChild:quad];
// UIKit stuff needs to be doubled on ipad
uimult = 1.0f;
if (!IS_PHONE) { uimult = 2.0f; }
// DRAW BACKGROUND
SPImage *background = [[GameManager sharedManager] getImage:@"somebackground"];
[self addChild:background];
// DRAW LOGO
SPImage *logo = [[GameManager sharedManager] getImage:@"logo-1"];
[logo centralizeWithX:PERCW(0.5f) andY:logo.height / 2.0f];
[self addChild:logo];
// DRAW BUTTONS FOR VARIOUS MODES AND FUNCTIONS
SPImage *ribbon = [[GameManager sharedManager] getImage:ribbonImageString];
ribbon.x = PERCW(0.5f) - ribbon.width / 2.0f;
ribbon.y = logo.y + logo.height / 2.0f;
[self addChild:ribbon];
float yjump = 0.0f;
// Have to calculate the size of content for scrollview manually:
float contentSize = [[[GameManager sharedManager] songNames] count] * buttonHeight;
UIScrollView *sv = [[UIScrollView alloc] initWithFrame:CGRectMake((ribbon.x + ribbon.width * 0.17f) * uimult, (ribbon.y + ribbon.height * 0.22f) * uimult, (ribbon.width * 0.66f) * uimult, (ribbon.height * 0.45f) * uimult)];
[sv setContentSize:CGSizeMake(sv.frame.size.width, contentSize)];
sv.pagingEnabled = NO;
[sv setBackgroundColor:[UIColor clearColor]];
[sv setCanCancelContentTouches:NO];
sv.indicatorStyle = UIScrollViewIndicatorStyleWhite;
sv.clipsToBounds = YES;
sv.scrollEnabled = YES;
for (NSString *songName in [[GameManager sharedManager] songNames]) {
UIButton *bb = [UIButton buttonWithType:UIButtonTypeCustom];
bb.frame = CGRectMake(0.0f, yjump, sv.frame.size.width, buttonHeight);
[bb setTitle:songName forState:UIControlStateNormal];
[bb setBackgroundColor:[UIColor clearColor]];
[bb addTarget:self action:@selector(selectedSong:) forControlEvents:UIControlEventTouchUpInside];
[bb setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
[bb setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
[[bb titleLabel] setFont:[UIFont fontWithName:@"SomeFont" size:fontSize]];
[[bb titleLabel] setTextColor:[UIColor whiteColor]];
[bb setTitleShadowColor:[UIColor colorWithRed:0.3f green:0.3f blue:0.3f alpha:0.9f] forState:UIControlStateNormal];
[[bb titleLabel] setShadowOffset:CGSizeMake(2.0f, 2.0f)];
[sv addSubview:bb];
yjump += bb.frame.size.height;
}
[Sparrow.currentController.view addSubview:sv];
[sv setContentOffset:CGPointMake(0.0f, buttonHeight * 0.2f)];
SPButton *p2 = [[SPButton alloc] initWithUpState:[[GameManager sharedManager] getTexture:@"bp-more"]];
[p2 centralizeWithX:PERCW(0.44f) andY:(SCENE_HEIGHT - p2.height * 0.8f) * 3.0f];
p2.name = @"10";
[p2 addEventListener:@selector(goToLevel:) atObject:self forType:SP_EVENT_TYPE_TRIGGERED];
[self addChild:p2];
}
return self;
}
@end