Wrap text
|
|
#import "SampleApp.h"
#include
#include
@implementation SampleApp
- (void)acceleratedInX:(float)xx Y:(float)yy Z:(float)zz
{
// Create Status feedback string
NSString *xstring = [NSString stringWithFormat:
@"X (roll, %4.1f%%): %f\nY (pitch %4.1f%%): %f\nZ (%4.1f%%) : %f",
100.0 - (xx + 0.5) * 100.0, xx,
100.0 - (yy + 0.5) * 100.0, yy,
100.0 - (zz + 0.5) * 100.0, zz];
[textView setText:xstring];
// Revert Arrow and then rotate to new coords
[xarrow setTransform:CGAffineTransformIdentity];
float angle = atan2(yy, xx);
angle *= 180.0/3.14159;
[xarrow setRotationBy:angle];
}
- (void) applicationDidFinishLaunching: (id) unused
{
struct CGRect rect = [UIHardware fullScreenApplicationContentRect];
rect.origin.x = rect.origin.y = 0.0f;
window = [[UIWindow alloc] initWithContentRect: rect];
mainView = [[UIView alloc] initWithFrame: rect];
textView = [[UITextView alloc] initWithFrame:
CGRectMake(0.0, 0.0, 320.0, 480.0)];
[textView setEditable:NO];
[textView setTextSize:24];
[mainView addSubview: textView];
xarrow = [[UIImageView alloc] initWithFrame:
CGRectMake(50.0, 320.0, 200.0, 50.0)];
UIImage *img = [[UIImage imageAtPath:
[[NSBundle mainBundle]
pathForResource:@"arrow"
ofType:@"png"
inDirectory:@"/"]] retain];
[xarrow setImage:img];
[textView addSubview:xarrow];
[window orderFront: self];
[window makeKey: self];
[window _setHidden: NO];
[window setContentView: mainView];
}
@end
|