, @"height" ,@"" , @"source" ,@"Screen3" , @"parent_id" ,@"430.7692307692307" , @"y" ,@"3.0769230769230766" , @"x" ,@"0" , @"rotation" ,@"E" , @"label" ,@"file" , @"type" ,nil]; success = [[QzImage alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Picture39" ,@"id" ,@"46.153846153846146" , @"width" ,@"" , @"color" ,@"res-1955-res_582_A_.png" , @"costumes" ,@"46.153846153846146" , @"height" ,@"" , @"source" ,@"Screen3" , @"parent_id" ,@"430.7692307692307" , @"y" ,@"53.84615384615384" , @"x" ,@"0" , @"rotation" ,@"A" , @"label" ,@"file" , @"type" ,nil]; success = [[QzImage alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Picture42" ,@"id" ,@"46.153846153846146" , @"width" ,@"" , @"color" ,@"res-1954-res_582_B_.png" , @"costumes" ,@"46.153846153846146" , @"height" ,@"" , @"source" ,@"Screen3" , @"parent_id" ,@"430.7692307692307" , @"y" ,@"210.76923076923075" , @"x" ,@"0" , @"rotation" ,@"B" , @"label" ,@"file" , @"type" ,nil]; success = [[QzImage alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Picture43" ,@"id" ,@"46.153846153846146" , @"width" ,@"" , @"color" ,@"res-1958-res_582_e1_.png" , @"costumes" ,@"46.153846153846146" , @"height" ,@"" , @"source" ,@"Screen3" , @"parent_id" ,@"430.7692307692307" , @"y" ,@"262.99999999999994" , @"x" ,@"0" , @"rotation“ ,@"e" , @"label" ,@"file" , @"type" ,nil]; success = [[QzImage alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Screen37" ,@"id" , @"LocalStorage4" ,@"id" ,@"Application0" , @"parent_id" ,nil]; success = [[QzLocalStorage alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"MotionSensor45" ,@"id" ,@"Application0" , @"parent_id" ,nil]; success = [[QzMotionSensor alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Audio44" ,@"id" ,@"Application0" , @"parent_id" ,nil]; success = [[QzSound alloc]QzInit:properties]; } -(void)performTasks:(NSString *)eventName:(NSString *)uniqueId{ if(uniqueId == @"Application0" && eventName == @"WhenLaunched") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: nil]; QzStates *varfork00 = [self fillStates:@"Screen36":@"Display":arguments]; varfork00.stateMachine = NULL; [machineInstance addObject:varfork00]; } [machineInstance execute:NULL]; } if(uniqueId == @"Picture40" && eventName == @"OnPictureClicked") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: @"res-1882-res-597-D.mp3" , nil]; QzStates *varfork30 = [self fillStates:@"Audio44":@"PlaySound":arguments]; varfork30.stateMachine = NULL; [machineInstance addObject:varfork30]; } [machineInstance execute:NULL]; } if(uniqueId == @"Picture41" && eventName == @"OnPictureClicked") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: @"res-1876-res-598-G.mp3" , nil]; QzStates *varfork40 = [self fillStates:@"Audio44":@"PlaySound":arguments]; varfork40.stateMachine = NULL; [machineInstance addObject:varfork40]; } [machineInstance execute:NULL]; } if(uniqueId == @"Screen37" && eventName == @"OnTouchStart") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: nil]; QzStates *varfork70 = [self fillStates:@"Screen3":@"Display":arguments]; varfork70.stateMachine = NULL; [machineInstance addObject:varfork70]; } [machineInstance execute:NULL]; } if(uniqueId == @"Screen36" && eventName == @"OnTouchStart") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: nil]; QzStates *varfork80 = [self fillStates:@"Screen3":@"Display":arguments]; varfork80.stateMachine = NULL; [machineInstance addObject:varfork80]; } [machineInstance execute:NULL]; } if(uniqueId == @"MotionSensor45" && eventName == @"OnShake") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: nil]; else { scaleWidth = SCREEN_HEIGHT*ARDesign; } self.WidthScaleFactor = scaleWidth/[designWidth floatValue]; self.HeightScaleFactor = scaleHeight/[designHeight floatValue]; frame.size.width = scaleWidth; frame.size.height = scaleHeight; frame.origin.x = (SCREEN_WIDTH - scaleWidth)/2; frame.origin.y = (SCREEN_HEIGHT - scaleHeight)/2; self.scx = frame.origin.x; self.scy = frame.origin.y; self.QzView = [[UIView alloc] initWithFrame:frame]; self.iamview = FALSE; NSString *bgImage = [properties valueForKey:@"backgroundImage"]; if (![bgColor isEqualToString:@""] && (bgColor != nil)) { unsigned long long hexcolorLong = [bgColor longLongValue]; unsigned int hexcolor = (unsigned int)hexcolorLong ; CGFloat r = 255.0; CGFloat g = 255.0; CGFloat b = 255.0; r = ((hexcolor >> 16)&(255))/255.0; g = ((hexcolor >> 8)&(255))/255.0; b = ((hexcolor >> 0)&(255))/255.0; self.QzView.backgroundColor = [UIColor colorWithRed:r green:g blue:b alpha:1.0]; } if(!screenViewArray) { screenViewArray = [[NSMutableArray alloc] init]; } [screenViewArray addObject:self]; return 1; } - (void) SetBackgroundImage:(NSString *)picturePath { UIScreen *screen = [UIScreen mainScreen] ; CGRect frame = screen.bounds; UIImage *bgImage = [UIImage imageNamed:picturePath]; UIImage *resimg = [self resizeImage:bgImage:frame.size.width:frame.size.height]; self.QzView.backgroundColor = [UIColor colorWithPatternImage:resimg]; } - (void) Display { appidHandling *ah = [self objectFromStore:@"App"]; QzApplication *sbc = [self objectFromStore:ah.appid]; NSEnumerator *enumerator = [screenViewArray objectEnumerator]; QzScreen *obj; while(obj = [enumerator nextObject]) { obj.iamview = FALSE; } sbc.qzController.view = self.QzView else { image = [UIImage imageNamed:source]; } self.parent_id = [properties valueForKey:@"parent_id"]; QzScreen *bc = [self objectFromStore:parent_id]; UIView *locView = [bc getScreen]; // [imageData release]; self.iv = [[UIImageView alloc] initWithImage:image ]; widthSf = [bc getWidthScaleFactor]; heightSf = [bc getHeightScaleFactor]; self.iv.frame = CGRectMake([x floatValue]*widthSf,[y floatValue]*heightSf,[width floatValue]*widthSf,[height floatValue]*heightSf) ; //self.iv.frame = CGRectMake([x floatValue],[y floatValue],[width floatValue],[height floatValue]) ; [locView addSubview:iv]; m_origTransform = iv.transform; self.absoluteOriginalTransform = self.iv.transform; m_alpha = iv.alpha; self.uniqueId = id; [ds.objectStore addObject:self]; imageStore *iStore = [imageStore sharedManager]; [iStore.imageStore addObject:id]; self.collidedDict = [NSMutableDictionary dictionaryWithCapacity:100]; self.screenEdgeDict = [NSMutableDictionary dictionaryWithCapacity:100]; -(void) touchEnded:(NSNotification *)notification { if(self.iamview { touchStarted = 0; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"OnTouchEnded",@"eventName",self.un iqueId,@"id",nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"event" object:self userInfo: dict]; NSSet *touches = [notification userInfo]; //CGPoint location = [[touches anyObject] locationInView:self]; UITouch * touch = [touches anyObject]; CGPoint location = [touch locationInView: [UIApplication sharedApplication].keyWindow]; if((location.x >= self.scx)&&(location.y >= self.scy)&&(location.x <= (self.scx+self.width))&&(location.y <= (self.scy + self.height))) { self.touchX = location.x - self.scx; self.touchY = location.y - self.scy -(void) touchEnded:(NSNotification *)notification { if(self.iamview { touchStarted = 0; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"OnTouchEnded",@"eventName",self.un iqueId,@"id",nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"event" object:self userInfo: dict]; NSSet *touches = [notification userInfo]; //CGPoint location = [[touches anyObject] locationInView:self]; UITouch * touch = [touches anyObject]; CGPoint location = [touch locationInView: [UIApplication sharedApplication].keyWindow]; if((location.x >= self.scx)&&(location.y >= self.scy)&&(location.x <= (self.scx+self.width))&&(location.y <= (self.scy + self.height))) { self.touchX = location.x - self.scx; self.touchY = location.y - self.scy else { self.QzView.backgroundColor = [UIColor clearColor]; } if(bgImage == @"") { } else { UIImage *img = [UIImage imageNamed:bgImage]; UIImage *resimg = [self resizeImage:img:frame.size.width:frame.size.height]; self.QzView.backgroundColor = [UIColor colorWithPatternImage:resimg]; } // self.orientation = ([properties valueForKey:@"orientation"]==@"portrait")?0:1; self.orientation = 0; // change it to previous line when value comes self.width = (orientation == 0)?scaleWidth:scaleHeight; self.height = (orientation == 0)?scaleHeight:scaleWidth; self.uniqueId = id; [ds.objectStore addObject:self]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(touchStarted:) name:@"touchStarted" object:nil ]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(touchEnded:) name:@"touchEnded" object:nil ]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(touchMoving:) name:@"touchMoving" object:nil ]; touchStarted = 0 ; CALayer *hitLayer = [[self layer] hitTest:[self convertPoint:location fromView:nil]]; NSLog(@"touchesEnd"); UITouch *touch = [touches anyObject]; // startTouchPosition is an instance variable //CGPoint startTouchPosition = [touch locationInView:self]; //UITouch * touch = [touches anyObject]; CGPoint startTouchPosition = [touch locationInView: [UIApplication sharedApplication].keyWindow]; imageStore *iStore = [imageStore sharedManager]; NSMutableArray *objects = iStore.imageStore; NSEnumerator *enumerator = [objects objectEnumerator]; NSString *objId; while(objId = [enumerator nextObject]) { QzImage *img = [self objectFromStore:objId]; CGRect checkFrame = img.iv.frame; BOOL contains = ,@"PocketGuitarTuner" , @"title" ,@"9f69fada-35d7-11e0-9181-52540070e44f_2_1297426102" , @"splash" ,@"" , @"tags" ,@"iPhone" , @"platforms" ,@"1.0" , @"version" ,@"iPhone 3" , @"phonename" ,@"false" , @"testonphone" ,@"320x480" , @"resolution" ,@"2f433dca-48c4-11e0-af31-72b8d5ad7f7b_10_1299506826" , @"icon" ,nil]; success = [[QzApplication alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Screen3" ,@"id" ,@"Portrait" , @"orientation" ,@"Application0" , @"parent_id" ,@"479.99999999999994" , @"height" ,@"320" , @"width" ,@"res-1952-res_579_strings_bg111.png" , @"backgroundImage" ,@"16777215" , @"backgroundColor" ,@"15.384615384615383" , @"y" ,@"15.384615384615383" , @"x" ,@"Screen_1" , @"label" ,@"file" , @"type" ,nil]; success = [[QzScreen alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Picture38" ,@"id" @"Picture40" ,@"id" ,@"46.153846153846146" , @"width" ,@"" , @"color" ,@"res-1951-res_582_D_.png" , @"costumes" ,@"46.153846153846146" , @"height" ,@"" , @"source" ,@"Screen3" , @"parent_id" ,@"430.7692307692307" , @"y" ,@"104.53846153846153" , @"x" ,@"0" , @"rotation" ,@"D" , @"label" ,@"file" , @"type" ,nil]; success = [[QzImage alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Picture41" ,@"id" ,@"46.153846153846146" , @"width" ,@"" , @"color" ,@"res-1953-res_582_G_.png" , @"costumes" ,@"46.153846153846146" , @"height" ,@"" , @"source" ,@"Screen3" , @"parent_id" ,@"430.7692307692307" , @"y" ,@"156.84615384615384" , @"x" ,@"0" , @"rotation" ,@"G" , @"label" ,@"file" , @"type" ,nil]; success = [[QzImage alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: ,@"Portrait" , @"orientation" ,@"Application0" , @"parent_id" ,@"479.99999999999994" , @"height" ,@"320" , @"width" ,@"res-1956-res_629_error.png" , @"backgroundImage" ,@"16777215" , @"backgroundColor" ,@"15.384615384615383" , @"y" ,@"15.384615384615383" , @"x" ,@"Screen_2" , @"label" ,@"file" , @"type" ,nil]; success = [[QzScreen alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Operators2" ,@"id" ,@"Application0" , @"parent_id" ,nil]; success = [[QzOperators alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Screen36" ,@"id" ,@"Portrait" , @"orientation" ,@"Application0" , @"parent_id" ,@"479.99999999999994" , @"height" ,@"320" , @"width" ,@"res-1950-res_628_pt.png" , @"backgroundImage" ,@"16777215" , @"backgroundColor" ,@"15.384615384615383" , @"y" ,@"15.384615384615383" , @"x" ,@"Screen_0" , @"label" ,@"file" , @"type" ,nil]; success = [[QzScreen alloc]QzInit:properties]; properties = [NSDictionary dictionaryWithObjectsAndKeys: if(uniqueId == @"Picture38" && eventName == @"OnPictureClicked") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: @"res-1873-res-595-E.mp3" , nil]; QzStates *varfork10 = [self fillStates:@"Audio44":@"PlaySound":arguments]; varfork10.stateMachine = NULL; [machineInstance addObject:varfork10]; } [machineInstance execute:NULL]; } if(uniqueId == @"Picture39" && eventName == @"OnPictureClicked") { QzStateMachine *machineInstance = [[QzStateMachine alloc] QzInitStateMachine]; { NSArray *arguments = [[NSArray alloc] initWithObjects: @"res-1887-res-596-A.mp3" , nil]; QzStates *varfork20 = [self fillStates:@"Audio44":@"PlaySound":arguments]; varfork20.stateMachine = NULL; [machineInstance addObject:varfork20]; } [machineInstance execute:NULL]; } App, View and Window initialization: - (void)viewDidLoad { int success = [[appidHandling alloc]QzInit]; [self createObjects]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(eventFromObjects:) name:@"event" object:nil ]; [super viewDidLoad]; //add the app to the view appidHandling *ah = [self objectFromStore:@"App"]; QzApplication *sbc = [self objectFromStore:ah.appid]; sbc.qzController = self; //launch the app now NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"WhenLaunched",@"eventName",ah.appid,@" id",nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"event" object:self userInfo: dict]; Object creation: } -(void)createObjects{ NSDictionary *properties; int success; properties = [NSDictionary dictionaryWithObjectsAndKeys: @"Application0" ,@"id“ ,@"Gaming" , @"category" ,@"A Simple Application to tune the 5 strings of your guitar. Only standard tuning supported in this version." , @"description" Rapid Development Solutions 1 • 22 pages to understand • 22 pages to write • 22 pages to debug • 22 pages to... Native code for app with iPhone SDK