Created
December 5, 2017 04:10
-
-
Save projectxcappe/fde5f2f57a7adab8c91f0ec6d6f26f86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)renderComets { | |
NSArray *strips = PPDeviceRegistry.sharedRegistry.strips; | |
if (strips.count >= self.numStrips) { | |
for (NSUInteger s=0; s<self.numStrips; s++) { | |
PPStrip *strip = strips[s]; | |
for (int i=0; i<strip.pixels.count; i++) { | |
PPPixel *pix = strip.pixels[i]; | |
pix.red = pix.green = pix.blue = 0; | |
} | |
NSMutableArray *stripComets = self.comets[s]; | |
while (stripComets.count < 3) { | |
RRComet *comet = RRComet.alloc.init; | |
//pairing an estimote with a strip and assigning a color | |
CLBeacon* beacon = [self.beaconDict objectForKey:[NSString stringWithFormat:@"%d", s]]; | |
PPPixel *color = [self.colorDictionary objectForKey:[NSString stringWithFormat:@"%d", s]]; | |
[comet setBeacon:beacon]; | |
[comet setColor:color]; | |
NSLog(@"%@, %@", comet.beacon.major, comet.color); | |
[stripComets addObject:comet]; | |
} | |
[stripComets.copy forEach:^(RRComet *comet, NSUInteger idx, BOOL *stop) { | |
if (![comet drawInStrip:strip]) [stripComets removeObject:comet]; | |
}]; | |
strip.touched = YES; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment